Forum Discussion

bluerobot's avatar
bluerobot
Regular Visitor
2 years ago
Solved

Show top 3 based on months using card visuals

I have a table as follow:

MonthDestinationValue
October 2024Japan10
October 2024Indonesia9
October 2024Spain8
October 2024Saudi Arabia4
October 2024India3
October 2024UK2
September 2024Japan11
September 2024Turkiye7
September 2024Spain6
September 2024Indonesia5
September 2024UAE4
September 2024US3
September 2024Vietnam1

 

I'm struggling to create 3 card visuals showing top 3 Destinations based on Value. I also want to add a month slicer so that the viz will show the top 3 for specific months

 

For example, these are the top 3 for all months

 

And these are the top 3 for September only

 

I'm new to Power BI and I'd be thankful for any helps!

  • bluerobot 

     

    Create a measure:

    Rank Destinations = 
    IF (
    ISBLANK(CALCULATE(SUM('Table'[Value]))), // Check if Value is blank for the current context
    BLANK(),
    RANKX(
    FILTER(
    ALL('Table'), // Replace 'Table' with the actual name of your table
    'Table'[Month] = SELECTEDVALUE('Table'[Month]) // Filter by current month
    ),
    CALCULATE(SUM('Table'[Value])), // Rank by Value directly
    ,
    DESC,
    DENSE
    ))

    Add visual level, bottom 3 filter:

     

    Let me know if this resolves the issue or if you need further assistance!

     

    πŸ’Œ If this helped, a Kudos πŸ‘ or Solution mark would be great! πŸŽ‰
    Cheers,
    Kedar
    Connect on LinkedIn

     

4 Replies

  • bluerobot 

     

    Create a measure:

    Rank Destinations = 
    IF (
    ISBLANK(CALCULATE(SUM('Table'[Value]))), // Check if Value is blank for the current context
    BLANK(),
    RANKX(
    FILTER(
    ALL('Table'), // Replace 'Table' with the actual name of your table
    'Table'[Month] = SELECTEDVALUE('Table'[Month]) // Filter by current month
    ),
    CALCULATE(SUM('Table'[Value])), // Rank by Value directly
    ,
    DESC,
    DENSE
    ))

    Add visual level, bottom 3 filter:

     

    Let me know if this resolves the issue or if you need further assistance!

     

    πŸ’Œ If this helped, a Kudos πŸ‘ or Solution mark would be great! πŸŽ‰
    Cheers,
    Kedar
    Connect on LinkedIn

     

    • bluerobot's avatar
      bluerobot
      Regular Visitor

      Thank you, exactly what I was looking for! Another q, what visual is that to show all 3 result at once?