Forum Discussion
Boolean IF Statements - Need Help
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 date | Closed Code |
| 19/07/2023 | Closed 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:
- mlsx43 years agoMemorable Member
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