Forum Discussion
Creating an entry based upon a date compared to today
- 3 years ago
It would be helpful next time (or if this doesn't work) to include some sample data to work with.
The order matters with these statements, so try this instead.
Status Approval = SWITCH ( TRUE (), ISBLANK ('Execution Status'[Approved Date].[Date]) && ('Execution Status'[Due Date].[Date]) < TODAY (), "Overdue", ISBLANK ( 'Execution Status'[Approved Date].[Date] ), "In Process", 'Execution Status'[Approved Date].[Date] < 'Execution Status' [Due Date].[Date], "On Time", "Completed Late" )
If I understand you correctly, maybe something like this...
Status Approval =
SWITCH (
TRUE (),
ISBLANK ( '[Approved Date].[Date]' )
&& '[Due Due].[Date]'
> TODAY (), "Overdue",
'[Approved Date].[Date]' > '[Due Date].[Date]', "Late",
ISBLANK ( '[Approved Date].[Date]' ), "In Process",
"On Time"
)
PowerBI doesn't like that
- KNP3 years agoSuper User
Try removing the single quotes maybe?
- PowerBINoob243 years agoResolver I
Had to do that and add the table name. Not throwing an error anymore, but still not populating the field correctly.
Overdue seems to be working correctly, but the filed is populating with On Time when the Approved date field is blank. That should be "In Process". The "Completed late" calcuation appears to be correct as well.
Status Approval =
SWITCH (
TRUE (),
ISBLANK ('Execution Status'[Approved Date].[Date])
&& ('Execution Status'[Due Date].[Date]) < TODAY (), "Overdue",
'Execution Status'[Approved Date].[Date] < 'Execution Status' [Due Date].[Date], "On Time",
ISBLANK ( 'Execution Status'[Approved Date].[Date] ), "In Process","Completed Late"
)- KNP3 years agoSuper User
It would be helpful next time (or if this doesn't work) to include some sample data to work with.
The order matters with these statements, so try this instead.
Status Approval = SWITCH ( TRUE (), ISBLANK ('Execution Status'[Approved Date].[Date]) && ('Execution Status'[Due Date].[Date]) < TODAY (), "Overdue", ISBLANK ( 'Execution Status'[Approved Date].[Date] ), "In Process", 'Execution Status'[Approved Date].[Date] < 'Execution Status' [Due Date].[Date], "On Time", "Completed Late" )