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!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hi All,
I have 2 columns reporting_mth and Amount, I want to create rank based on reporting_mth and sort data based on amount.
Now If you see i have 202203 and 202212 in my data. I am expecting ouput like
I am expecting output like below .if we have 2 same reportingmonth with different monthnumber than always give max Outstanding Amount as rank 1.
reporting_mth | Outstanding Amount | Rank |
201803 | 2996300950580 | 1 |
201903 | 3431078559335 | 1 |
202003 | 3865145306221 | 1 |
202103 | 4057019515671 | 1 |
202203 | 4406709276776 | 2 |
202212 | 4992165757965 | 1 |
@ranku @PoiwerBInovice @po @PowerZ @PBCommunity
Hi @Sandeep13
You can create a measure
Measure = var a=LEFT(SELECTEDVALUE('Table'[reporting_mth]),4)
return RANKX(FILTER(ALLSELECTED('Table'),LEFT([reporting_mth],4)=a),CALCULATE(SUM('Table'[Outstanding Amount])),,DESC,Dense)
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Sample PBIX file attached
https://1drv.ms/u/s!AiUZ0Ws7G26RiHACZ_Smu67Qkufg?e=tdVPVU
Hey While using your code i am getting error massage.
the query referenced calculated column which does not hold any data there is an error in its expression.
Share sample pbix file to help you.
Hi Thanks for your reply.
For me I dont see attached option here becuase I am not a super user.
I have uploaded file in powerbi services. below is link for your refernce,.
Let me know if you are not able to open the link.
If possible share me your email id so i can give you persmission dirclty
Order =
VAR _t = LEFT( MAX( [reporting_mth],4))
RETURN
RANKX(
FILTER(ALL('Table'),
LEFT('Table'[reporting_mth],4)=_t),
[reporting_mth],,DESC)
Still some issue.
I am Passing dax in measure.
Getting below errro msg.
A single value for column 'reporting_mth' in table 'Port_Append' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.
pls try this
you create a column, you don't need to create a measure
Hi thank you for your response but its give me error.
reporting_mth is a column in my data.
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.