Forum Discussion
Anonymous
4 years agoNot applicable
Dax Aggregation for Country level
Hai All, I need one help on this The above table % Share range is the expecting output I want to achieve this logic at the Dax level Users want to see the % total at the country level For...
- 4 years ago
Hi Anonymous
Please use the following code
% Share Range = VAR Numerator = [# Model Number] VAR T1 = CALCULATETABLE ( Initiative, ALLEXCEPT ( Initiative, Initiative[Country] ) ) VAR T2 = SUMMARIZE ( T1, Initiative[Country], Initiative[Category] ) VAR T3 = ADDCOLUMNS ( T2, "Models", [# Model Number] ) VAR Denominator = SUMX ( T3, [Models] ) RETURN IF ( HASONEVALUE ( Initiative[Country] ), DIVIDE ( Numerator, Denominator ), 1 )
tamerj1
Community Champion
4 years agoHi Anonymous
Please use the following code
% Share Range =
VAR Numerator = [# Model Number]
VAR T1 =
CALCULATETABLE ( Initiative, ALLEXCEPT ( Initiative, Initiative[Country] ) )
VAR T2 =
SUMMARIZE ( T1, Initiative[Country], Initiative[Category] )
VAR T3 =
ADDCOLUMNS ( T2, "Models", [# Model Number] )
VAR Denominator =
SUMX ( T3, [Models] )
RETURN
IF ( HASONEVALUE ( Initiative[Country] ),
DIVIDE ( Numerator, Denominator ),
1
)