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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Chanleakna123
Post Prodigy
Post Prodigy

Dax Help on Condition IF or OR

Hi everyone .
i'm working on Condition dax which a bit complicate over here and i have never experienced this before. 

We have code , must have SKU etc.. and Count. in this case , BI will count all number and sum together over the different code provide. but i wanna have exceptional over few codes.  

 

Look at yellow highlight on 1317 count 1 , 1108 count 1 , both of them will be 2 as calculation. 

 

but this is exeption :  IF 1317 count 1 and 1108 count 1 both of them will count  only 1 , 

IF 4295 count 1 and 2239 count 1 both of them will count only 1 

 

For the rest let's calculate as normal sum. 

 

 

 1.PNG

 

and i used below  calculation as BI Team's mentioned . and when i do testing filter on code number that i put together with Customer Code , it turn out to wrong number , actually the right data is  4295= 1 , 2239= 1 = Total 1 

it should not be the number as 8 , 9 or 10 , it's not as expected. because my original data only show count 1 on each customer code with Code ,  can you please help to correct this? i'm looking forward. 

 

1.PNG

 

2.PNG3.PNG

5 REPLIES 5
Chanleakna123
Post Prodigy
Post Prodigy

HI All , 

 

Can somebody helps me using Dax over IF & OR , 

I have Code , Material Description , Count and Customer Code & Name , 

 

* You see the Code number 4223 count 1 , and 1300 Count 1 , 
If i Visualize customer code with Code number and count columns , these will sum up together Total : 2 

 

*But i wanna set Condition , If 4223 Count 1 , 1300 Count 1 , Total 1 only 

and this is the calculation i used on Excel Total =IF(OR(V5=1,W5=1),1,0) 

 

For the rest let's calculate as Normal Sum

 

and i have repeatedly Code number to be repeadted on Excel . Can i cook this in BI ?

 

2.PNG

 

2.PNG

 

1.PNG

v-danhe-msft
Employee
Employee

Hi @Chanleakna123 ,

but this is exeption :  IF 1317 count 1 and 1108 count 1 both of them will count  only 1 , 

IF 4295 count 1 and 2239 count 1 both of them will count only 1 

For the rest let's calculate as normal sum. 

I could not figure out how could you count the number? Could you please post your desired result if possible?

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

HI @v-danhe-msft  really thanks for your response , 

 

I have the calculation in Excel as per yellow highlight , 

 

i have  different code numbers , and you see Green Column , means the calcuation of below. 

 

ANY Coke 1.5L OR 2.25L =IF(OR(V5=1,W5=1),1,0)

1.PNG

Hi @Chanleakna123 ,

It seemed your formula could work normally in Power BI, could you have tried it? Below is my test formula:

AD = IF(OR([AB]=1,[AC]=1),1,0)

Result:

1.PNG

 

Regards,

Daniel He

 

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-danhe-msft  , hi you get what i mean ? Or do i need more explanation to acheive this ? 
Your response is really a big help now to my side. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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