cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Employee

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

 Sku Store Count Assortment 123433 1 343433 234 234355 1 565466 454 987971 1000

Thanks
Ding

1 ACCEPTED SOLUTION
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.

2 REPLIES 2
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.

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")``

do not hesitate to give a kudo to useful posts and mark solutions as solution

Announcements

Fabric certifications survey

Certification feedback opportunity for the community.

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors