Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
dixia
Microsoft Employee
Microsoft 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

 

SkuStore CountAssortment
1234331 
343433234 
2343551 
565466454 
9879711000 

 

Thanks
Ding

1 ACCEPTED SOLUTION
V-lianl-msft
Community Support
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.

View solution in original post

2 REPLIES 2
V-lianl-msft
Community Support
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.

az38
Community Champion
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
LinkedIn

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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

Top Solution Authors