Forum Discussion
DAX: SUM of ALLSELECTED by group (combine ALLSELECTED and ALLEXCEPT)
- Sep 10, 2021
Such formula is for the measure, not calculated column. In general it's better to avoid calculated columns at all and use only measures, with very few exceptions.
Sum Selected by Quarter:=CALCULATE ( SUM ( Table1[Qty] ), ALLSELECTED ( Table1 ), VALUES ( Table1[Quarter] ) )
I'm not sure what you'd like to calculate. What this measure do
For the QuarterRank = 4 we have values in quarters 1 and 4 (returned by ALLSELECTED). With that measure calculates sum of qty for all quarters 1 and 4, now independently of the rank, totally 116.
Such formula is for the measure, not calculated column. In general it's better to avoid calculated columns at all and use only measures, with very few exceptions.
Sum Selected by Quarter:=CALCULATE (
SUM ( Table1[Qty] ),
ALLSELECTED ( Table1 ),
VALUES ( Table1[Quarter] )
)
I'm not sure what you'd like to calculate. What this measure do
For the QuarterRank = 4 we have values in quarters 1 and 4 (returned by ALLSELECTED). With that measure calculates sum of qty for all quarters 1 and 4, now independently of the rank, totally 116.
- bartvanaSep 11, 2021Iron ContributorVery clear, thank you!
- SergeiBaklanSep 11, 2021Diamond Contributor
bartvana , glad it helped