@mwegener if you could help with this whenever you get time. I have tried many solutions but nothing is woring with card display. Rank is coming fine in table display but when I am selecting a name from slicer its not giving corrrect rank on card disply.
I couldn't see the attached button to attach my sample file. But here is my data. I am not sure if the blanks for year are giving any problem:
I have slicer for name and year. I need to show rank of selected year and name in a card. If name is not selected the show the rank of 2018+2019. I don't need to include the sales in calculation for which year is blank.
@v-gizhi-msft hello, did you try this ranking measure on card display. its not showing correct ranking in card if I am selecting a name from slicer. In table its coming fine.
rank = RANKX(ALL('Table'[Name]),CALCULATE(SUM('Table'[Sales])),,DESC,Dense)
... and put an advanced filter on the (card) visual "Table [Year] is not blank"
Dortmund - Germany
If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support.
The measure in a Card visual can only show the single value.
According to your description that if name is not selected, then it should show the rank of 2018+2019.
But for each year, it has different ranks and can not be put in a Card visual as one single value.
Do you want to compare 2018+2019 total sales with other year's total sales such as 2017 or 2016?
Please give more info.
Please try this rank measure:
rank = IF(SELECTEDVALUE('Table'[Year])<>BLANK(),RANKX(ALLSELECTED('Table'),CALCULATE(SUM('Table'[Sales])),,DESC,Dense),RANKX(ALL('Table'),CALCULATE(SUM('Table'[Sales])),,DESC,Dense))
Visit our Community Blog for articles, guides, and information created by fellow community members.
Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.
Looking for inspiration on how to present your data? Need instructional videos? Check out our Galleries!
Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications