i want to create a calculated column, which will show two values: Y or N
2 columns are here important, "VAT-ID" and "CUSTOMER-ID". the calculated column will check if a customer-ID has multiple VAT-IDs. If yes the value "Y" should be displayed, else "N".
for example, the first 5 rows of the customer-id column are:
123456
654321
666666
123456
654321
the first 5 rows of the VAT-id column are:
EE999999999
AA999999999
GG999999999
KK999999999
AA999999999
the first 5 rows of the calculated column should be then:
Y
N
N
Y
N
any Help would be appreciated
Calculated columns don’t allow for aggregations across groups or other than the current row.
What you can do to achieve your goal is to create a separate aggregation node and count distinct VAT-IDs grouped by CUSTOMER-ID.
With this, you can now have a calculated column that checks for VAT-ID-COUNT > 1 and map it to your Y/N values.
As Lars mentioned it is not possible to use a window function within a calculated field on HANA table
But you can use following query to check if VAT number is multiple for a customer or not
select
CustomerId, VATID,
case
when (count(*) over (partition by CustomerId, VATID)) > 1
then 'Y'
else 'N'
end
from CustomerVAT;
Related
In this scenario, I am looking to total Columns G through M by 'user' in Column E. Column N does have the correct data, but it is using the formula =sum(f4:m5). I am looking for a way to add an array formula because the heights of the merged cells in column N varies often. A formula would be preferred to a script in this case.
try:
=INDEX(IFNA(VLOOKUP(F2:F,
QUERY(SPLIT(FLATTEN(IF(G2:M="",,F2:F&"♀"&G2:M)), "♀"),
"select Col1,sum(Col2) group by Col1"), 2, 0)))
I'm trying to display all of the distinct values within this table (there are many other columns in this table) and show how many rows each distinct value shows in.
I have tried to use group by but this does not work. It needs to be filterable by country from another column but i can do that by page filter.
I am trying to show what the top 5 associations are in terms of appearance.
enter image description here
Put the 10 columns in a Table visual. Then create this measure and add it too. Then sort descending on Distinct.
Distinct = COUNTROWS('Your Table Name')
To see only the Top 5, go to the Filter pane, and pick the first column and set the Filter type to Top N, and then Top 5 by the Distinct measure.
I have a table below, and I need to calculate the last column as a custom measure/custom column. I'm grateful for any advice concerning the formulae. Please note this is a single table. The last column counts the number of rows which have as PID, the respective row's UID.
Please note, I am using SharePoint lists so addressing the ID column will be done via: 'SharePoint list name'[Id] which is the standard syntax when calling a SharePoint list column.
ID PID Count rows
1 2
2 1 1
3 1 0
4 0
5 2 0
Many thanks for considering my request.
I am using Power BI Desktop 2.83.
I found the answer:
Create a second identical SharePoint list and use the below.
Additional column =
calculate (
COUNTROWS('SharePoint list (replica)'),
FILTER('SharePoint list (replica)','SharePoint list (replica)'[PID]='SharePoint list'[ID])
)
I'm looking for good solution to be able to present on a table visual in Power BI TOP 5 highest values out of column X in table, grouped by User name in column Y of the same table.
So for each distinct user in column Y I need to show top 5 values in column X in descending order.
You can get the Top 5 details by using the RANKX function:
Rank = RANKX(CALCULATETABLE(Table,ALLEXCEPT(Table,Table[Column Y])),Table[Column X],,DESC,DENSE)
The above calculation will give you the dense rank. If you want the normal ranking use "skip" instead of "dense". Once the rank is calculated, you can filter the rank value for <=5 and you should be able to get the desired output.
I have a problem to solve similar to the example in the image below. I have the values of Column 1, 2 and 3, and want to get the calculated values exampled in Column 4. These are the number of times that the same number of Column 3 appears for different combinations of values from Column 1 and 2.
Thanks in advance for any help!
If your table has as name 'table1',
then the following dax statement will calculate column4.
Column4 = CALCULATE(countrows(Table1);filter(Table1;Table1[Column3]= EARLIER(Table1[Column3])))
Keep in mind that based on regional settings, you have to replace the ; with , in the example provided.