Forum Discussion
Calculated table with additional calculated column
- 2 years ago
Anonymous , Without creating multiple intermediate tables, you can use a single DAX expression that combines the steps.
Ranking =
VAR _AllPlants =
CALCULATETABLE(
SUMMARIZE(
'For Plants',
'For Plants'[Customer],
'For Plants'[Plant abb],
"Sum of act", SUM('For Plants'[Actuals in LC])
)
)VAR _RankedPlants =
ADDCOLUMNS(
_AllPlants,
"Rank", RANKX(
FILTER(_AllPlants, 'For Plants'[Plant abb] = EARLIER('For Plants'[Plant abb])),
[Sum of act],
,
DESC,
DENSE
)
)RETURN _RankedPlants
Anonymous , Without creating multiple intermediate tables, you can use a single DAX expression that combines the steps.
Ranking =
VAR _AllPlants =
CALCULATETABLE(
SUMMARIZE(
'For Plants',
'For Plants'[Customer],
'For Plants'[Plant abb],
"Sum of act", SUM('For Plants'[Actuals in LC])
)
)
VAR _RankedPlants =
ADDCOLUMNS(
_AllPlants,
"Rank", RANKX(
FILTER(_AllPlants, 'For Plants'[Plant abb] = EARLIER('For Plants'[Plant abb])),
[Sum of act],
,
DESC,
DENSE
)
)
RETURN _RankedPlants