Forum Discussion

dixia's avatar
dixia
Microsoft Employee
6 years ago
Solved

Meaure with If statement

i am trying to write a DAX measure with if statement to return a value as assortment.  if Store count =1, " Online",  otherwise "Instore".  both "SKU" and "Store count" are from the same dim - master table

 

SkuStore CountAssortment
1234331 
343433234 
2343551 
565466454 
9879711000 

 

Thanks
Ding

  • Hi dixia ,

     

    If your store count is not calculated by DAX, you need to use DAX to calculate the store count and then use if statement.

    Try the DAX like this:

    Assortment = IF(calculate(count(table[store]),allexcept(table(SKU)))=1, "Online", "Instore")

     

    Best Regards,
    Liang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • az38's avatar
    az38
    Community Champion

    Hi dixia 

    I thin there is enough to create a simpliest calculated column in your dimTable like

    Assortment = IF([Store Count], "Online", "Instore")

     

  • V-lianl-msft's avatar
    V-lianl-msft
    Community Support

    Hi dixia ,

     

    If your store count is not calculated by DAX, you need to use DAX to calculate the store count and then use if statement.

    Try the DAX like this:

    Assortment = IF(calculate(count(table[store]),allexcept(table(SKU)))=1, "Online", "Instore")

     

    Best Regards,
    Liang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.