Forum Discussion
Rank on Calculated measure
Hi ,
I need help plz provide the solution.
Below is a pseudo data for understanding and currently working in Direct query .
i have line and stacked bar chart .
in x-axis I have 2 dimension Product and checks. Checks contains T,F,N values.
In columns y axis I have a calculated measure sales and Legend is category columns.
I have several filters and paramters applied.
I am trying to create a rank function ,
code: RANKS(
SUMMARIZE( ALLSELECTED( 'Table'), 'Table'[Product],'Table[Checks],'Table'[Category]),
[Sales], ,DESC,DENSE)
but for 2 product i am getting same rank and but 2 product didn't have the same values .
Please help in these.
- Anonymous3 years ago
Hi Nobie
You can refer to the following measure
Measure = var a=SUMMARIZE(ALLSELECTED('Table'),[Product],"Sum",SUM('Table'[Sales])) var b=ADDCOLUMNS(a,"Rank",RANKX(a,[Sum],,DESC,Dense)) return MAXX(FILTER(b,[Product] in VALUES('Table'[Product])),[Rank])Output
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.
9 Replies
- vanessafvg
Community Champion
can you provide some sample data with your expected solution?
- Nobie
Helper II
i have attached a excel .
basically i want the rank on the basis on Product on basis on sales and line and checks to be ignored .- vanessafvg
Community Champion
Hi thanks, but where is the attachment? I need the data in text format to do this.
- AnonymousNot applicable
Hi Nobie
You can refer to the following measure
Measure = var a=SUMMARIZE(ALLSELECTED('Table'),[Product],"Sum",SUM('Table'[Sales])) var b=ADDCOLUMNS(a,"Rank",RANKX(a,[Sum],,DESC,Dense)) return MAXX(FILTER(b,[Product] in VALUES('Table'[Product])),[Rank])Output
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.
- Nobie
Helper II
Can u plz tell me what does statement after return doing?