March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi,
I have the following tables
Dim :
LocationCodeName | Locationcode |
A | A001 |
B | B001 |
C | C001 |
D | D001 |
E | E001 |
F | F001 |
SalesFact :
Locationcode | Qty |
A001 | 8 |
B001 | 20 |
E001 | 60 |
F001 | 40 |
C001 | 22 |
Target:
Locationcode | Target |
A001 | 10 |
B001 | 20 |
E001 | 30 |
F001 | 40 |
C001 | 20 |
Target % = Divide(Sales- Target , Target) *100
So i need to calculate rank as follows:
LocationCodeName | Qty | Target | Target % | Rank |
A | 8 | 10 | -20 | 4 |
B | 20 | 20 | 0 | 3 |
C | 22 | 20 | 10 | 2 |
D | ||||
E | 60 | 30 | 100 | 1 |
F | 40 | 40 | 0 | 3 |
Rank should be given based on highest to lowest target% including 0 (which means the location has met its target completely - Location B001 and F001 in this case) however excluding non-existing location (means no target was given to these location in this month - Location D001 in this case).
I tried the following DAX formula but it doesnt work for null values (where there was no target given):
Solved! Go to Solution.
Thanks @lbendlin for your response,
It's working perfectly. Really appreciate it.
Also, I found another way to resolve this :
If you are interested you can run both versions of this through DAX Studio and compare the query plans and server timings.
CALCULATE([Target %]) seems redundant.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
6 | |
3 | |
3 | |
2 | |
2 |