Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Rishabh-Maini
Helper II
Helper II

Top N values including Ties

Hi, 

I have the following table:

 

Capture.PNG

I want to display the days with maximum sale, including all days if it is a tie.
In the above example, I wish to display "Mon, Thur" in this format. 

I DO NOT want a table with two values. I want to display a card with these two values separated by a comma. (and so on and so forth if there are 3 days with the same sale amount), something like this:

RishabhMaini_0-1629753412098.png

 



Is this possible in Power BI at all?

Thanks!

1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@Rishabh-Maini,

 

Try this measure:

 

Highest Sale = 
VAR vTable =
    ADDCOLUMNS (
        VALUES ( Table1[Day] ),
        "@Rank", RANKX ( ALL ( Table1[Day] ), CALCULATE ( SUM ( Table1[Sale] ) ),, DESC, DENSE )
    )
VAR vTopValues =
    FILTER ( vTable, [@Rank] = 1 )
VAR vResult =
    CONCATENATEX ( vTopValues, Table1[Day], ", " )
RETURN
    vResult

 

DataInsights_0-1629756975002.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

4 REPLIES 4
DataInsights
Super User
Super User

@Rishabh-Maini,

 

Try this measure:

 

Highest Sale = 
VAR vTable =
    ADDCOLUMNS (
        VALUES ( Table1[Day] ),
        "@Rank", RANKX ( ALL ( Table1[Day] ), CALCULATE ( SUM ( Table1[Sale] ) ),, DESC, DENSE )
    )
VAR vTopValues =
    FILTER ( vTable, [@Rank] = 1 )
VAR vResult =
    CONCATENATEX ( vTopValues, Table1[Day], ", " )
RETURN
    vResult

 

DataInsights_0-1629756975002.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@DataInsights 
You, are a blessing. 
Thank you so much!

While here, could you suggest any websites/sources where I can learn/practice/explore DAX measures (instead of only working on them when a requirement rolls in)? Would really appreciate it. 

@Rishabh-Maini,

 

Check out these sites:

 

https://www.sqlbi.com (check out their book "The Definitive Guide to DAX")

https://enterprisedna.co

https://radacad.com

 

DAX is a tricky language that requires a conceptual understanding. Invest the time necessary to learn concepts, and measures will flow more easily. 🙂





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@DataInsights Thanks once again!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.