Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
HI DATANUTS!!!
For sure this is a simple one.
I have an UNPIVOTED hierarchies table "[DIM_SET]". Some characteristics of this table are:
From wat we already now, DAX doesn’t support this type of hierarchies natively. Therefore, I build this “UNPIVOTED” hierarchies table in Access. I also added the “PATH” column to be able to use some DAX path functions.
I’m trying to build a calculated column (L2_PATHS_COUNTROWS) to count how many times each L2 id is present among all paths.
Here I have an example for L2 id “1465660” :
L2_PATHS_COUNTROWS = COUNTROWS(FILTER(DIM_SET;PATHCONTAINS(DIM_SET[PATH];"1465660")))
The result is 8 and it is correct. Now I need to perform this calculation for each L2 id row.
THANKS IN ADVANCE!
DIM_SET.TXT (LINK)
Solved! Go to Solution.
Hi @Anonymous ,
As the sharing link has expired.So I create a sample for your refernce. Please create a calculated column using the formula.
Column = CALCULATE ( COUNTROWS ( DIM_SET ), FILTER ( ALLEXCEPT ( DIM_SET, DIM_SET[L2] ), PATHCONTAINS ( DIM_SET[Path], DIM_SET[L2] ) ) )
Attched the pbix:)
Regards,
Frank
Hi @Anonymous ,
Does that make sense? If so, kindly mark my answer as the solution to close the case please. Thanks in advance.
Regards,
Frank
Hi @Anonymous,
To create a calculated column as below. If it doesn't meet your requirement, kindly share your sample data to me, if you don't have confidential data? Please upload your file to One Drive and share the link here.
Measure = CALCULATE(COUNT(DIM_SET[L2]),FILTER(DIM_SET,DIM_SET[L2]=1465660))
Regards,
Frank
Just updated the post with the file link.
This formula is a MEASURE, I need a CALCULATED COLUMN that evaluates the column [PATH] for each row of [L2] counting in how many paths each [L2] Id is present.
Thank you.
Hi @Anonymous ,
As the sharing link has expired.So I create a sample for your refernce. Please create a calculated column using the formula.
Column = CALCULATE ( COUNTROWS ( DIM_SET ), FILTER ( ALLEXCEPT ( DIM_SET, DIM_SET[L2] ), PATHCONTAINS ( DIM_SET[Path], DIM_SET[L2] ) ) )
Attched the pbix:)
Regards,
Frank
Thanks!!!
Short answer is yes, THE FORMULA IS CORRECT. Now, it is IMPOSSIBLE TO APPLY due to the performance. On the example attached I see that you reduced the hierarchies to run the formula, but unfortunately for an 85k rows hierarchies table it is impossible to run it. Instead I used a MEASURE for each level.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
95 | |
76 | |
65 | |
51 |
User | Count |
---|---|
146 | |
109 | |
106 | |
88 | |
61 |