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
Mederic
Helper V
Helper V

Alternative to Multiple conditions if then else

Hello everyone,


I have a request that could be made with many conditions that are a bit complicated to manage
I don't know how to solve this kind of case more simply

How can I please handle such a case ?

I hope that with the image, my request is clearer

 

Thank you in advance for your help

Regards

 

Image.jpg

 

POPOSTEDate POClosing DateAmountBenefit
8900027101/10/202221/12/20223412
8900027201/10/202205/01/202078-7
8900028112/11/202228/01/20231204
8900028212/11/202204/02/2023122
8900028312/11/202212/01/2023-36-9
8900028412/11/202216/12/2022-65-15
8900032115/12/202216/12/20226723
8900056113/01/202319/01/202313531
8900056213/01/202328/02/20232411
8900078118/02/202307/03/20237834
8900078218/02/202307/03/2023-15-3
8900078318/02/202312/03/2023447

 

Date POClosing DateAmountBenefitOutput
01/01/202301/03/2023  A
01/01/202301/03/2023100 B
01/01/202301/03/2023100 C
 01/03/2023 0D

 

 

1 ACCEPTED SOLUTION
serpiva64
Super User
Super User

Hi,

with your lookup table i don't know how you get this result "C"??

serpiva64_1-1679438080159.png

 

however this is a possible formulaif [Benefit]<0 and [Closing Date]<#date(2023,03,01) then "D"
else if [Amount]>100 and [Date PO]<#date(2023,01,01) and [Closing Date]<#date(2023,03,01) then "C"
else if [Date PO]<#date(2023,01,01) and [Closing Date]<#date(2023,03,01) and [Amount]>0 and [Amount]<=100 then "B"
else if [Date PO]>#date(2023,01,01) or [Closing Date]>#date(2023,03,01) then "A"
else "Z"

serpiva64_3-1679438307564.png

 

you obtain

serpiva64_2-1679438156536.png

If this post is useful to help you to solve your issue, consider giving the post a thumbs up and accepting it as a solution!

 

View solution in original post

3 REPLIES 3
Mederic
Helper V
Helper V

Hello @serpiva64 ,
I have taken your code and adjusted it slightly to my real file.
I'm very happy with the result, and I didn't get any error messages.
Thanks again for your help
Have a nice day

Regards

Mederic
Helper V
Helper V

Hello @serpiva64 ,

I'll your code during the day,
Yes, it's more complicated to do that from a matrix table.
I will also look into your question about the "C" result in your screenshot

It's probably wrong what I put

Thanks
Have a nice day

serpiva64
Super User
Super User

Hi,

with your lookup table i don't know how you get this result "C"??

serpiva64_1-1679438080159.png

 

however this is a possible formulaif [Benefit]<0 and [Closing Date]<#date(2023,03,01) then "D"
else if [Amount]>100 and [Date PO]<#date(2023,01,01) and [Closing Date]<#date(2023,03,01) then "C"
else if [Date PO]<#date(2023,01,01) and [Closing Date]<#date(2023,03,01) and [Amount]>0 and [Amount]<=100 then "B"
else if [Date PO]>#date(2023,01,01) or [Closing Date]>#date(2023,03,01) then "A"
else "Z"

serpiva64_3-1679438307564.png

 

you obtain

serpiva64_2-1679438156536.png

If this post is useful to help you to solve your issue, consider giving the post a thumbs up and accepting it as a solution!

 

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.

Top Solution Authors
Top Kudoed Authors