Forum Discussion

Arjun_reddy's avatar
Arjun_reddy
Helper I
3 years ago
Solved

dax query

Hi Community team,

 

I need you help on build dax query for second largest retail channel on total sales
I am sharing the code for first largest retail channel  on total sales 

1largest_TotalChannel =
VAR MaxTotal = MAX(Tostitos_MP[TOTAL OCCASIONS])
VAR Maxyear=MAX(Tostitos_MP[YEAR])
VAR CHANNEL_OCC=
    CALCULATE(
        VALUES(Tostitos_MP[RETAIL CHANNEL]),
        Tostitos_MP[TOTAL OCCASIONS] = MaxTotal,Tostitos_MP[YEAR]=Maxyear
    )
    RETURN
    CHANNEL_OCC

Please check the code and modify for second largest retail channel on total occasions 

Thanks,
Arjun Reddy

9 Replies

    • Arjun_reddy's avatar
      Arjun_reddy
      Helper I

      Hi Ahmedx,

       

      I am unable to add power bi and excel file, please find the below attachment.

       

       

      Thanks,

      Arjun Reddy.

    • Arjun_reddy's avatar
      Arjun_reddy
      Helper I

      Please find the below data table

      categoryyearsales
      chairs20215000
      tables20216000
      bulbs20226000
      sofa20224500
      chairs20228000
      chairs20216000
      chairs20212800
      sofa20224700
      bulbs20222000
      sofa20215500
      tables20216000
      tables20223400
      bulbs20214000
      • Ahmedx's avatar
        Ahmedx
        Super User

        you can show what result you expect