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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
TylerVono
Helper III
Helper III

Boolean IF Statements - Need Help

Hello I am trying to do a nested IF statement but keep arriving on an error:

TylerVono_0-1689732133799.png

Here is the equation:

 

PO Status = if(AND('PO Data'[Closed for Receipt Date]>'PO Data'[First Promised Date],'PO Data'[BooleanMeasureClosedCode] = "CLOSED"||"CLOSED FOR INVOICE"||"CLOSED FOR RECEIVING"||"FINALLY CLOSED"),"Delivered Late", if(and('PO Data'[First Promised Date]<today(),isblank('PO Data'[Closed for Receipt Date])&& 'PO Data'[PO Status]="OPEN"),"Currently Past Due","")
 
BooleanMeasureClosedCode = if('PO Data'[Closed Code] = "CLOSED" || "CLOSED FOR INVOICE" || "CLOSED FOR RECEIVING",TRUE(),FALSE())
 
My Data Type is True/False.
 
My Column: [Closed Code] just tells three options: CLOSED,CLOSED FOR INVOICE, CLOSED FOR RECEIVING AND OPEN.
 
What am I doing wrong?
5 REPLIES 5
TylerVono
Helper III
Helper III

Hello @mlsx4 , I dont understand....what should be the correct way to write the measure? I basically just want the measure to say if any of those closed options are present and the Receipt Date is later than the Promised Date, then its 'Delivered Late".

 

= if(AND('PO Data'[Closed for Receipt Date]>'PO Data'[First Promised Date],'PO Data'[BooleanMeasureClosedCode] = "CLOSED"||"CLOSED FOR INVOICE"||"CLOSED FOR RECEIVING"||"FINALLY CLOSED"),"Delivered Late"," "))

The thing is that at the end you are trying to compare a text with a true/false value.

Imagine you have this data:

 

Closed dateClosed Code
19/07/2023Closed for receiving

 

What you have written will do:

BooleanMeasureClosedCode= TRUE -> Because it is closed for receiving.

 

And now when you go to PO status, it will try to do: 

 if(AND('PO Data'[Closed for Receipt Date]>'PO Data'[First Promised Date]TRUE = "CLOSED"||"CLOSED FOR INVOICE"||"CLOSED FOR RECEIVING"||"FINALLY CLOSED"),

 

Do you see what I'm trying to explain? That now you are trying that True = to one of the status...Therefore, it doesn't make any sense.

 

 

You don't need the measure which returns true.... You have to directly do:

 

 

 

PO Status = if(AND('PO Data'[Closed for Receipt Date]>'PO Data'[First Promised Date],'PO Data'[ClosedCode] = "CLOSED"||"CLOSED FOR INVOICE"||"CLOSED FOR RECEIVING"||"FINALLY CLOSED"),"Delivered Late", if(and('PO Data'[First Promised Date]<today(),isblank('PO Data'[Closed for Receipt Date])&& 'PO Data'[PO Status]="OPEN"),"Currently Past Due","")

 

Or if you want to use the measure, just check if PO Data'[BooleanMeasureClosedCode] = true or false (as needed)

 

 Btw, I don't know if it works since I don't have any kind of data or structure.

Oh yes I see, I think I was over-complicating it.... so now I have a different error:

 

TylerVono_0-1689766961870.png

 

Now, I cannot figure out what is happening 😅

 

My advice is that you try to check the code step by step. For instance, check if the first condition is working: 

 

PO Status = if('PO Data'[Closed for Receipt Date]>'PO Data'[First Promised Date],1,0)

 

If it is, try to add another piece of code:

 

PO Status = if(AND('PO Data'[Closed for Receipt Date]>'PO Data'[First Promised Date],'PO Data'[ClosedCode]= "CLOSED"),1,0)

 

And so on...

Anyway, if you provide a piece of data with the structure of what you are trying to calculate, I could help you

mlsx4
Memorable Member
Memorable Member

Hi @TylerVono 

 

You are trying to compare the result of BooleanMeasureClosedCode which will be True or False with text here:

 

BooleanMeasureClosedCode = if('PO Data'[Closed Code] = "CLOSED" || "CLOSED FOR INVOICE" || "CLOSED FOR RECEIVING",TRUE(),FALSE())

 

PO Data'[BooleanMeasureClosedCode] = "CLOSED"||"CLOSED FOR INVOICE"||"CLOSED FOR RECEIVING"||"FINALLY CLOSED")

 

I mean the part is green is what you get and the part in red what you are trying to compare... Then True() or False() will never be "Closed" or something like this.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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