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
Anonymous
Not applicable

If Statements doesn't give value as expected, skips the code

Hi,

 

I am trying to use the DAX measure and here is my scenario where IF statement gives blank for case 2

 

Case 1:- Material Group LBLTHT or CORSF, Material Type- ZHWA and Base UOM- EA and ROL

Base UOM Highlights = Maxx( material,
IF(Material[Material group]="CORSF" || Material[Material group]="LBLTHT",
IF(Material[Material type]="ZHWA",
IF (Material[Base Unit of Measure]<>"EA" && Material[Base Unit of Measure]<>"ROL",1,2))
 
Capture2.PNG
The above code works fine ( screeshot above) however in the same code if I add the below code it get skipped
 
Case 2: -Material Group LBLTHT , Material Type- ZNBW and Base UOM- EA 
IF(Material[Material group]="LBLTHT",
IF(Material[Material type]="ZNBW",
IF (Material[Base Unit of Measure]<>"EA" ,1,2))

this above code get skipped and it doesn't add 2 ( screesnhot below) for this combination and gives me Blank data.
Capture.PNG
Any help greatly appreaciated!
5 REPLIES 5
dax
Community Support
Community Support

Hi tejaswidmello,

 

I test your expression in my environment, it work well , so I am not sure which part cause this problem. You could check whether your measure is correct or whether other factors cause this problem . If possible, could you please inform me more detailed information (such as your data sample or upload your pbix sample)? Then I will help you more correctly.

Measure 8 = MAXX(Table5,IF(Table5[group]="LBLTHT",
IF(Table5[type]="ZNBW",
IF (Table5[meas]<>"EA" ,1,2))))

47.png

Please do mask sensitive data before uploading.

 

Best Regards,

Zoe Zhi

 

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

 

Anonymous
Not applicable

 Hi Zoe @dax 

Thanks for your reply!

 

The one you showed works for me until we do not  add the case 1 code in it..  for ex. shown below: ( the below code includes both Case 1 and case 2.) This code won't work for the later part of the code which says material group= LBLTHT, Type- ZNBW and BUOM<> EA. and if it finds this combination it adds blank

 

I want both these cases in the same measure. 

 

Can you please help with this? 

 

 

Base UOM Highlights = Maxx( material,
IF(Material[Material group]="CORSF" || Material[Material group]="LBLTHT",
IF(Material[Material type]="ZHWA",
IF (Material[Base Unit of Measure]<>"EA" && Material[Base Unit of Measure]<>"ROL",1,2)),
IF(Material[Material group]="LBLTHT",
IF(Material[Material type]="ZNBW",
IF (Material[Base Unit of Measure]<>"EA" ,1,2))
 
Thanks,
Tejaswi
Anonymous
Not applicable

 

@MattAllington 

 

can you please help me with this?

 

Anonymous
Not applicable

@MFelix ,

 

May be you can help me with this?

 

Anonymous
Not applicable

Can anyone help me with this issue?

 

@Cmcmahan may be you can help me with this? 

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.