Forum Discussion
DAX- Percentage calculation at different granularity
- 7 years ago
Hi Atul,
You can use ALLSELECTED instead of ALL to do this.
To make your measure as general as possible (based on your current model), you could write
P Mix = DIVIDE ( SUM ( Sheet1[Prior Volume] ), CALCULATE ( SUM ( Sheet1[Prior Volume] ), ALLSELECTED ( Sheet1[Product Hier], Sheet1[Product Hier lvl 1], Sheet1[Product Hier lvl 2] ) ) )Using this measure, the denominator would be determined by any slicers filtering the table.
For convenience, it might be better to have a Product table related to your existing table, which would simplify the above measure since you could write ALLSELECTED ( 'Product' ).
Regards,
Owen
Hi Atul,
You can use ALLSELECTED instead of ALL to do this.
To make your measure as general as possible (based on your current model), you could write
P Mix =
DIVIDE (
SUM ( Sheet1[Prior Volume] ),
CALCULATE (
SUM ( Sheet1[Prior Volume] ),
ALLSELECTED ( Sheet1[Product Hier], Sheet1[Product Hier lvl 1], Sheet1[Product Hier lvl 2] )
)
)
Using this measure, the denominator would be determined by any slicers filtering the table.
For convenience, it might be better to have a Product table related to your existing table, which would simplify the above measure since you could write ALLSELECTED ( 'Product' ).
Regards,
Owen
Owen,
Thank you.
I tried using ALLSELECTED too, but only with Prod Heir Level 1, which gave me 100% every time. this makes sense now. Thanks again.
Regards,
Atul