Forum Discussion

yewling1201's avatar
yewling1201
Frequent Visitor
4 years ago
Solved

Get the Popular Favourite Meal Type

Hi,

 

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

 

Thank you!

  • 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

2 Replies

  • SpartaBI's avatar
    SpartaBI
    Icon for Community Champion rankCommunity 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

  • Hi,

    Write these measures

    Customer count = countrows(Table)

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