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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
yewling1201
Frequent Visitor

Get the Popular Favourite Meal Type

Hi,

 

How do I calculate the count the Customers to get the top popular Meal Type?

yewling1201_0-1650807414508.png

 

Thank you!

1 ACCEPTED SOLUTION
SpartaBI
Community Champion
Community Champion

@yewling1201 

 

 

Popular Meal = 
    CONCATENATEX (
        TOPN (
            1,
            ADDCOLUMNS (
                VALUES ( 'Table'[Meal Type] ),
                "@Customers", CALCULATE ( COUNTROWS ( 'Table' ) )
            ),
            [@Customers]
        ),
        [Meal Type],
        ", "
    )

 

 

 


In case you have ties in the 1st rank it will show them seperated with ", "

Hope that helps

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

Write these measures

Customer count = countrows(Table)

Measure = CONCATENATEX(TOPN(1,Data,[Customer count]),Data[Meal Type],", ")


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
SpartaBI
Community Champion
Community Champion

@yewling1201 

 

 

Popular Meal = 
    CONCATENATEX (
        TOPN (
            1,
            ADDCOLUMNS (
                VALUES ( 'Table'[Meal Type] ),
                "@Customers", CALCULATE ( COUNTROWS ( 'Table' ) )
            ),
            [@Customers]
        ),
        [Meal Type],
        ", "
    )

 

 

 


In case you have ties in the 1st rank it will show them seperated with ", "

Hope that helps

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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

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