Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello,
I have written a measure for cumulative total, but it is not working properly for instance where the values are same for different entity.
Below is the snapshot. I have also shared PBIX file in below link(We transfer link).
Solved! Go to Solution.
Hi @Anonymous ,
Normally I would take a lot more time to explain what I did but I am in a real hurry so here is the solution:
Measure 2 =
VAR _curRuleType = SELECTEDVALUE(Data[Rules Type])
VAR _filter = ALLEXCEPT(Data, Data[City], Data[Offence Count])
VAR _summaryTable = SUMMARIZE(_filter, [Rules Type], "TMargin", [Total Margin])
VAR _rankedTable = ADDCOLUMNS(_summaryTable, "Ranked",
VAR curRuleType = [Rules Type]
RETURN
RANKX(_summaryTable,
RANKX(_summaryTable, [TMargin], , DESC, Skip) +
DIVIDE(RANKX(_summaryTable, [Rules Type], , ASC, Skip), COUNTROWS(_summaryTable) + 1),
,DESC,Skip)
)
VAR _curRank = MAXX(FILTER(_rankedTable, [Rules Type] = _curRuleType), [Ranked])
RETURN
SUMX(FILTER(_rankedTable, [Ranked] >= _curRank), [TMargin])
Resulting in the following in your PBIX:
If you have any questions, please don't hesitate to ask and I will return tomorrow 🙂
Kind regards
Djerro123
-------------------------------
If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.
Keep those thumbs up coming! 🙂
Proud to be a Super User!
Hi @Anonymous ,
Normally I would take a lot more time to explain what I did but I am in a real hurry so here is the solution:
Measure 2 =
VAR _curRuleType = SELECTEDVALUE(Data[Rules Type])
VAR _filter = ALLEXCEPT(Data, Data[City], Data[Offence Count])
VAR _summaryTable = SUMMARIZE(_filter, [Rules Type], "TMargin", [Total Margin])
VAR _rankedTable = ADDCOLUMNS(_summaryTable, "Ranked",
VAR curRuleType = [Rules Type]
RETURN
RANKX(_summaryTable,
RANKX(_summaryTable, [TMargin], , DESC, Skip) +
DIVIDE(RANKX(_summaryTable, [Rules Type], , ASC, Skip), COUNTROWS(_summaryTable) + 1),
,DESC,Skip)
)
VAR _curRank = MAXX(FILTER(_rankedTable, [Rules Type] = _curRuleType), [Ranked])
RETURN
SUMX(FILTER(_rankedTable, [Ranked] >= _curRank), [TMargin])
Resulting in the following in your PBIX:
If you have any questions, please don't hesitate to ask and I will return tomorrow 🙂
Kind regards
Djerro123
-------------------------------
If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.
Keep those thumbs up coming! 🙂
Proud to be a Super User!
Wow..!! thats a big caluclation for small looking task.
Is there any other way to simplyfy the calculation/Measure?
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
104 | |
101 | |
79 | |
72 | |
64 |
User | Count |
---|---|
142 | |
108 | |
101 | |
81 | |
74 |