Forum Discussion

Jonjon_99's avatar
Jonjon_99
Icon for Helper I rankHelper I
2 years ago
Solved

POWER BI DAX IF STATEMENT

hi, i would like to create new column/DAX formula that will return my Product to "Others".

this is the sample

if the product = Montana, Paseo, Velo and VTT it will be tag as Others

TIA!
johnyip 

 

 

 

 

 

  • Ahmedx's avatar
    Ahmedx
    2 years ago

    then it’s better for you to create a table with the names of the products in an Excel file and upload it to power bi
    and then you can update the list at any time
    ----

    Measure = IF(MAX('yourtabl[product]) in VALUES('tablePro[Product]), "Others", MAX('yourtabl[product]))

4 Replies

  • pls try this

    Measure = IF(MAX('yourtabl[product]) in {Montana, Paseo, Velo, VTT}, "Others", MAX('yourtabl[product]))
    ----- 
    Column = IF('yourtabl[product] in {Montana, Paseo, Velo, VTT}, "Others", 'yourtabl[product])
    • Jonjon_99's avatar
      Jonjon_99
      Icon for Helper I rankHelper I

      thanks for this Ahmedx , what if my product ID is more than 100 lines that i need to tag as "Others", what is the best measure to use? 🙂

      • Ahmedx's avatar
        Ahmedx
        Icon for Super User rankSuper User

        then it’s better for you to create a table with the names of the products in an Excel file and upload it to power bi
        and then you can update the list at any time
        ----

        Measure = IF(MAX('yourtabl[product]) in VALUES('tablePro[Product]), "Others", MAX('yourtabl[product]))