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.
Hello,
I would like to request help from the community, I have a database that has categories and subcategories. As below:
Category | Subcategory | Value |
A | A1 | -1000 |
A | A2 | -256 |
A | A3 | -100 |
A | A4 | 20 |
B | B1 | -320 |
B | B2 | -152 |
B | B3 | -5 |
C | C1 | -73 |
C | C2 | 10 |
what I would like is within each Nth category, sort a list with the top N of the subcategories using DAX.
Solved! Go to Solution.
Hi @Anonymous ,
Please check:
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
RANK_SUB =
RANKX(
FILTER(
ALLSELECTED( 'DATASET'[Subcategory] ),
NOT ISEMPTY(
CALCULATETABLE(
'DATASET',
ALLEXCEPT( 'DATASET', 'DATASET'[Category], 'DATASET'[Subcategory] )
)
)
),
CALCULATE(
SUM( 'DATASET'[Value] ),
ALLEXCEPT( 'DATASET', 'DATASET'[Category], 'DATASET'[Subcategory] )
)
)
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
It would help if you show what the end result should be.
Thanks for the answers,
I tried to assemble what I'm trying to assemble, the yellow part would be cards and the green part, tables or matrices. Note that between the categories (from left to right) there is an order from largest to smallest (if you consider the sum) and within the categories as well. Thank you for your support!
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 |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |