Forum Discussion
Ranking
Hi there,
This is my very first post here in the community, so I hope I'm doing it in the right way π
I need some help with creating a dax formula for the table "Commodity" , that shows the rank for "Physical Commodity" based on the "Contracted Quantity", ignoring the impact of the "Date", like below:
"Contracted Quantity" is a measure, and "Date" and "Physical Commodity" are part of different tables.
Can you give me some suggestions?
Thanks
6 Replies
- Jihwan_Kim
Super User
Hi,
Please check the below picture and the attached pbix file.
Contract Qty: = SUM( sales[Contracted Quantity] )Ranking by physical commodity = RANK ( SKIP, ALL ( 'Physical Commodity'[Physical Commodity] ), ORDERBY ( [Contract Qty:], DESC ) )- AnonymousNot applicable
Hi Jihwan_Kim ,
Thanks for the suggestion, but it does not work π
If I add "Date" to the the table it's messing up with the rank.
Thanks,
Georgiana
- Dangar332
Resident Rockstar
hi, Anonymous
adjust your table name
try below one
result =
var a = SUMMARIZECOLUMNS('physical commodity'[physical commodity],"cont commodity",[contracted commodity])var b = SELECTCOLUMNS(a,"rankcomparing",[cont commodity])
returnrankx(b,[rankcomparing],[Contracted Quantity])
'physical commodity' -- is your table name so adjust it .
[Contracted Quantity] -- is your measue
- AnonymousNot applicable
Hi Dangar332,
[contracted commodity] from variable "a", I believe should be "contracted quantity", right?
In the form with "contracted quantity" the formula does not show anything π
Thanks
- Dangar332
Resident Rockstar
hi, Anonymous
try below measure
rank1 =RANK(SKIP,ALL('rank'),ORDERBY('rank'[contracted quantity],ASC))- AnonymousNot applicable
Dangar332 Jihwan_Kim thanks for trying.
I manage to solve it with Calculate and All functions.
Have a nice day!