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.
Hi, All.
Can you help me with this?
I have this kind of table that consist of location, item, status, score, & target.
1Score2: =
Here is my expected Result:
Cases:
If the Status is "NEGATIVE" or "LOW", the Rank must start in the lowest value.
If the Status is "NORMAL" or HIGH, the Rank must start in the highest value.
See Examples Below:
Thanks in Advance.
Please refer to this link for my sample files:
https://drive.google.com/drive/folders/1jDjGSM9fxMoXg3hxIiNIaQQRbBb54Euj
Solved! Go to Solution.
Hi, @Nnamarie_1997
If you need to rank by measure [1Score2: ],please try measure like:
Rank(1Score2) =
VAR tab =
ADDCOLUMNS (
SUMMARIZE (
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[LOCATION] = MAX ( 'Table'[LOCATION] )
&& 'Table'[STATUS] = MAX ( 'Table'[STATUS] )
),
'Table'[LOCATION],
'Table'[ITEM],
'Table'[STATUS]
),
"@1Score2", [1Score2:]
)
VAR CurrentValue = [1Score2:]
RETURN
SWITCH (
TRUE (),
SELECTEDVALUE ( 'Table'[STATUS] ) IN { "NEGATIVE", "LOW" }, RANKX ( tab, [@1Score2], CurrentValue, ASC, DENSE ),
SELECTEDVALUE ( 'Table'[STATUS] ) IN { "Normal", "High" }, RANKX ( tab, [@1Score2], CurrentValue, DESC, DENSE )
)
If you need to rank by field Table[SCORE],try measure like:
Rank(score) =
VAR tab =
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[LOCATION] = MAX ( 'Table'[LOCATION] )
&& 'Table'[STATUS] = MAX ( 'Table'[STATUS] )
)
RETURN
SWITCH (
TRUE (),
SELECTEDVALUE( 'Table'[STATUS] ) IN { "NEGATIVE", "LOW" }, RANKX ( tab, CALCULATE ( MAX ( 'Table'[SCORE] ) ),, ASC, DENSE ),
SELECTEDVALUE('Table'[STATUS] ) IN { "Normal", "High" }, RANKX ( tab, CALCULATE ( MAX ( 'Table'[SCORE] ) ),, DESC, DENSE )
)
Best Regards,
Community Support Team _ Eason
Hi, @Nnamarie_1997
Not quite understand what you mean. From your formula, the value of rank should depend on the value of [1Score2:].
What is your expected result?
Best Regards,
Community Support Team _ Eason
Hi @v-easonf-msft ,
Sorry for Late Reply.
Here is my expected result.
Cases:
If the Status is "NEGATIVE" or "LOW", the Rank must start in the lowest value.
If the Status is "NORMAL" or HIGH, the Rank must start in the highest value.
See Examples Below:
Thank You..
Hi, @Nnamarie_1997
If you need to rank by measure [1Score2: ],please try measure like:
Rank(1Score2) =
VAR tab =
ADDCOLUMNS (
SUMMARIZE (
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[LOCATION] = MAX ( 'Table'[LOCATION] )
&& 'Table'[STATUS] = MAX ( 'Table'[STATUS] )
),
'Table'[LOCATION],
'Table'[ITEM],
'Table'[STATUS]
),
"@1Score2", [1Score2:]
)
VAR CurrentValue = [1Score2:]
RETURN
SWITCH (
TRUE (),
SELECTEDVALUE ( 'Table'[STATUS] ) IN { "NEGATIVE", "LOW" }, RANKX ( tab, [@1Score2], CurrentValue, ASC, DENSE ),
SELECTEDVALUE ( 'Table'[STATUS] ) IN { "Normal", "High" }, RANKX ( tab, [@1Score2], CurrentValue, DESC, DENSE )
)
If you need to rank by field Table[SCORE],try measure like:
Rank(score) =
VAR tab =
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[LOCATION] = MAX ( 'Table'[LOCATION] )
&& 'Table'[STATUS] = MAX ( 'Table'[STATUS] )
)
RETURN
SWITCH (
TRUE (),
SELECTEDVALUE( 'Table'[STATUS] ) IN { "NEGATIVE", "LOW" }, RANKX ( tab, CALCULATE ( MAX ( 'Table'[SCORE] ) ),, ASC, DENSE ),
SELECTEDVALUE('Table'[STATUS] ) IN { "Normal", "High" }, RANKX ( tab, CALCULATE ( MAX ( 'Table'[SCORE] ) ),, DESC, DENSE )
)
Best Regards,
Community Support Team _ Eason
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 |
---|---|
46 | |
22 | |
20 | |
15 | |
13 |
User | Count |
---|---|
49 | |
41 | |
39 | |
19 | |
19 |