Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi,
I have two measures, a "Rank" and the "Measure". I need to divide all "Measure" by the "Measure" value where Rank =1.
This looks so easy but I can't get it to work! any ideas greatly appreciated. The "Desired" column is what I am trying to create.
Rank | Measure | Desired |
1 | 12000 | 1 |
2 | 10000 | 0.833333 |
3 | 8000 | 0.666667 |
4 | 5000 | 0.416667 |
Solved! Go to Solution.
To do a ranking you must be doing it over some column which is not visible in your sample data. So in the example below I've used a placeholder column called [Item] you will need to replace the reference to 'Table'[Item] with the reference to the actual column you are ranking over.
Once you do this a pattern like the following should work:
Desired =
var _rank1Measure = CALCULATE([Measure], FILTER(ALL('Table'[Item]),[Rank] = 1))
return DIVIDE([Measure], _rank1Measure)
Hi @Anonymous
Create measures
Measure = SUM('Table'[value])
rank = RANKX(ALLSELECTED('Table'),[Measure],,DESC,Dense)
rank1 = CALCULATE([Measure],FILTER(ALLSELECTED('Table'),'Table'[rank]=1))
%1 = [Measure]/[rank1]
Hi @Anonymous
Create measures
Measure = SUM('Table'[value])
rank = RANKX(ALLSELECTED('Table'),[Measure],,DESC,Dense)
rank1 = CALCULATE([Measure],FILTER(ALLSELECTED('Table'),'Table'[rank]=1))
%1 = [Measure]/[rank1]
To do a ranking you must be doing it over some column which is not visible in your sample data. So in the example below I've used a placeholder column called [Item] you will need to replace the reference to 'Table'[Item] with the reference to the actual column you are ranking over.
Once you do this a pattern like the following should work:
Desired =
var _rank1Measure = CALCULATE([Measure], FILTER(ALL('Table'[Item]),[Rank] = 1))
return DIVIDE([Measure], _rank1Measure)
Superb, thanks this works. This had really foxed me.
@mwegener - thanks I created the measures as you suggested but the slight issue was that within my data are multiple rows for the same entity and the top rank amount was not at the highest level
@d_gosbell - but when I added your additional measure it worked, thanks so much for your time, greatly appreciated
Hi @Anonymous ,
try this
Measure =
VAR Rank1 =
CALCULATE (
SUM ( 'Table'[Measure] ),
FILTER ( ALL ( 'Table' ), 'Table'[Rank] = 1 )
)
RETURN
DIVIDE ( SUM ( 'Table'[Measure] ), Rank1 )
If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support.
Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
109 | |
98 | |
96 | |
38 | |
36 |
User | Count |
---|---|
151 | |
125 | |
75 | |
74 | |
53 |