Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi there,
I'm a total newbie in DAX and struggling with this dataset:
Categories | Subcategories | Value | Total category value [desired] |
Cat A | Subcat 1 | 10 | 50 |
Cat A | Subcat 1 | 10 | 50 |
Cat A | Subcat 2 | 40 | 50 |
Cat B | Subcat 3 | 20 | 70 |
Cat B | Subcat 3 | 20 | 70 |
Cat A | Subcat 2 | 40 | 50 |
Cat B | Subcat 4 | 50 | 70 |
I have to create Total category value as a calculated column which contains the aggregated value of unique subcategories by category. For example 'Cat A' has two subcategories (Subcat 1 and 2) with multiple rows. 'Total category value' should be 10+40=50.
Thank you for your help!
Solved! Go to Solution.
Hi @ipeto
Total Category Value =
CALCULATE (
SUMX (
SUMMARIZE (
'Table',
'Table'[Categories],
'Table'[Subcategories]
),
CALCULATE ( MAX ( 'Table'[Value] ) )
),
ALLEXCEPT ( 'Table', 'Table'[Categories] )
)
Hi @ipeto
Total Category Value =
CALCULATE (
SUMX (
SUMMARIZE (
'Table',
'Table'[Categories],
'Table'[Subcategories]
),
CALCULATE ( MAX ( 'Table'[Value] ) )
),
ALLEXCEPT ( 'Table', 'Table'[Categories] )
)
Thank you for the superfast answer!
I have found parts of the solution, but I was unable to put them together.
User | Count |
---|---|
25 | |
12 | |
8 | |
6 | |
6 |
User | Count |
---|---|
26 | |
12 | |
11 | |
10 | |
6 |