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" )
PowerBI doesn't like that
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" )- PowerBINoob243 years agoResolver I
That did the trick. Thank you so much for your help. Still trying to learn all of this.