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

Multiple comparisons to give concatenated status

Hi all, 
 
I have a report that uses various dates to list the status of things - in order to condense the report I'd like to review the three date fields and then provide an update that confirms status, and then lists the date (e.g. Due - "23/09/2021")
 
I have tried IF AND as well as Switch options, but both have encountered errors for Switch I get "Switch does not support comparing values of type true/false with values of text" and for IF AND I think I may be getting the formulas wrong... 
 
So my code is like this currently: 
Status =
IF (AND(TODAY()>[Due], [Due]>=[Requested]), CONCATENATE("Due - ", [Due]),
IF (AND(TODAY()>[Requested], [Requested]>=[Received]), CONCATENATE("Requested - ", [Requested]),
IF (TODAY()>[027 Received], "Received", "0" )
 
But not giving the right outcomes, to clarify what I am trying to do with the formula - first check if the date in the [Due] column is later than TODAY, and then check that DUE is either the same as or equal to REQUEST (meaning that the form has been requested) and if that's the case the status should be REQUESTED, not DUE. 
 
Hopefully that makes sense, essentially it's just a IF ELSE statement? 
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , please share some sample data

 

Try Like

 

Status =
Switch (True() ,
AND(TODAY()>[Due], [Due]>=[Requested]), CONCATENATE("Due - ", [Due]),
AND(TODAY()>[Requested], [Requested]>=[Received]), CONCATENATE("Requested - ", [Requested]),
TODAY()>[027 Received], "Received", "0"
)

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Thanks! Yes, I kept on playing with it and switched things around so found a way to work this with nested IF ANDs (it's not pretty...) - but your solution works too 

amitchandak
Super User
Super User

@Anonymous , please share some sample data

 

Try Like

 

Status =
Switch (True() ,
AND(TODAY()>[Due], [Due]>=[Requested]), CONCATENATE("Due - ", [Due]),
AND(TODAY()>[Requested], [Requested]>=[Received]), CONCATENATE("Requested - ", [Requested]),
TODAY()>[027 Received], "Received", "0"
)

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.