Forum Discussion
ranking error
- 8 years ago
Hi,
Looks like the Ranking is correct on that screen shot as it's performing the ranking at customer level for each factory.
you'd need to adjust the RANKX statement to perform the ranking at factory level to change the values.I do something similar and I check to see what's filtered and amend the measure accordingly.
try this instead.
RankCustomer =
IF(HASONEVALUE(Table1[factory]),
RANKX(ALLSELECTED(Table1), CALCULATE(sum(Table1[sales]), ALLEXCEPT(Table,Table1[Customer], Table1[factory]))) ,
RANKX(ALLSELECTED(Sheet1), CALCULATE(sum(Sheet1[sales]), ALLEXCEPT(Sheet1,Sheet1[Customer])), ,DESC,Dense) )
Hi erihsehc,
Based on my test, the formula below should work in your scenario. :smileyhappy:
rank customer =
RANKX (
ALLSELECTED ( Table1 ),
CALCULATE ( SUM ( Table1[sales] ), ALLEXCEPT ( Table1, Table1[Customer], Table1[factory] ) ),
,
DESC,
DENSE
)
Regards
thanks v-ljerr-msft. The ranking is correct for factory, but if you select all factories and countries, the ranking is strange per my top post. :smileyhappy:
- v-ljerr-msft8 years agoMicrosoft Employee
Hi erihsehc,
My mistake. :smileylol:
Try the formula below. It should work.
rank customer = RANKX ( ALLSELECTED ( Table1[Customer]), CALCULATE ( SUM ( Table1[sales] ), ALLEXCEPT ( Table1, Table1[Customer], Table1[factory] ) ), , DESC, DENSE )Regards
- erihsehc8 years agoHelper III
thanks v-ljerr-msft, it is what I want.
Out of curiosity, I added the factory field to the table, the ranking seems strange again, not sure the logic of this ranking.
- Dog8 years agoResponsive Resident
Hi,
Looks like the Ranking is correct on that screen shot as it's performing the ranking at customer level for each factory.
you'd need to adjust the RANKX statement to perform the ranking at factory level to change the values.I do something similar and I check to see what's filtered and amend the measure accordingly.
try this instead.
RankCustomer =
IF(HASONEVALUE(Table1[factory]),
RANKX(ALLSELECTED(Table1), CALCULATE(sum(Table1[sales]), ALLEXCEPT(Table,Table1[Customer], Table1[factory]))) ,
RANKX(ALLSELECTED(Sheet1), CALCULATE(sum(Sheet1[sales]), ALLEXCEPT(Sheet1,Sheet1[Customer])), ,DESC,Dense) )