Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!View all the Fabric Data Days sessions on demand. View schedule
Hello,
Hope you can help me.
I have a table and I would like to rank each row grouped by country and with 2 conditions. The conditions are as follows:
Different dates may reflect different ranking.
The final result should be like this:
Can you please help me?
Thanks in advance.
Solved! Go to Solution.
Hi,
I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.
It is for creating a measure.
Rank measure: =
IF (
HASONEVALUE ( Country[Country] ),
CALCULATE (
COUNTROWS ( Data ),
WINDOW (
1,
ABS,
0,
REL,
SUMMARIZE (
ALL ( Data ),
Country[Country],
'Product'[Product],
Data[Qty],
Data[Sales Amount]
),
ORDERBY ( Data[Qty], DESC, Data[Sales Amount], DESC ),
KEEP,
PARTITIONBY ( Country[Country] )
)
)
)
Hi,
I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.
It is for creating a measure.
Rank measure: =
IF (
HASONEVALUE ( Country[Country] ),
CALCULATE (
COUNTROWS ( Data ),
WINDOW (
1,
ABS,
0,
REL,
SUMMARIZE (
ALL ( Data ),
Country[Country],
'Product'[Product],
Data[Qty],
Data[Sales Amount]
),
ORDERBY ( Data[Qty], DESC, Data[Sales Amount], DESC ),
KEEP,
PARTITIONBY ( Country[Country] )
)
)
)
Hello @Jihwan_Kim ,
Measure is not working when I select my table.
I only have a single table, should it worl the same way?
Rank measure: =
IF (
HASONEVALUE ( 'Data'[Country] ),
CALCULATE (
COUNTROWS ( 'Data' ),
WINDOW (
1,
ABS,
0,
REL,
SUMMARIZE (
ALL ( 'Data' ),
'Data'[Country],
'Data'[Product],
'Data'[Qty],
'Data'[Sales Amount]
),
ORDERBY ( Data[Qty], DESC, Data[Sales Amount], DESC ),
KEEP,
PARTITIONBY ( 'Data'[Country] )
)
)
)Thank you!
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 18 | |
| 11 | |
| 9 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 31 | |
| 25 | |
| 21 | |
| 14 | |
| 12 |