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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
PowerBINoob24
Resolver I
Resolver I

Creating an entry based upon a date compared to today

I have a status collumn that populates based upon a date column.  It works great except for the highlighted portion.  What I need to happen if the Approved Date field is blank and today is later than the Due Date field then I need the status approval field to show Overdue. Right now if the Approved Date is blank and today is later than the Due Date it still shows as In Process
 
Status Approval = IF(ISBLANK([Approved Date].[Date]), "In Process", IF(ISBLANK([Approved Date].[Date]) && (ISBLANK([Due Due].[Date]>TODAY()), "Overdue", IF([Approved Date].[Date]>[Due Date].[Date],"Late","On Time"))))
1 ACCEPTED SOLUTION

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"
)

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x

View solution in original post

8 REPLIES 8
Ashish_Mathur
Super User
Super User

Hi,

Try this calculated column formula

Status Approval = IF(ISBLANK([Approved Date]),IF(TODAY()>[Due date],"Overdue","In Process"),IF([Approved Date]>[Due Date],"Late","On Time"))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
KNP
Super User
Super User

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"
)
Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x

PowerBI doesn't like that

PowerBINoob24_0-1668653874974.png

 

Try removing the single quotes maybe?

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x

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"
)

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"
)

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x

That did the trick.  Thank you so much for your help.  Still trying to learn all of this.

Happy to help.

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

Check out the October 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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