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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

need a measure that compares dates and display status, Expired, Not Expired and Close to Expiry

hello Team,

I need to perform a measure in Powerbi that compare dates and give me results (Expiry Status)
A. Expired Status; Compare todays date with Expiry date field and display Status
B. Close to Expiry; Compare todays date against a field (Number of days to expire) and display status (Close to Expirey /Okay Not expired)

Since this is perishable stock, there is a table with field that has entered with number of days to warn before expiry and this
is important to factor when building this measure. 

 

thank you so much 

1 ACCEPTED SOLUTION
jthomson
Solution Sage
Solution Sage

I'm assuming that you've got some sort of relationship between your stock table and the table that holds your expiry warning cutoff times, one approach would be to:

 

- pull in the number of days that relates to that stock item as a variable

- use that number with TODAY() to work out when your warning date is

- make a nested if statement, seeing first if today's after the expiry date, then assigning a status of expired if it is, else seeing if today is after the warning date, then assigning a status of close to expired, otherwise not expired

View solution in original post

1 REPLY 1
jthomson
Solution Sage
Solution Sage

I'm assuming that you've got some sort of relationship between your stock table and the table that holds your expiry warning cutoff times, one approach would be to:

 

- pull in the number of days that relates to that stock item as a variable

- use that number with TODAY() to work out when your warning date is

- make a nested if statement, seeing first if today's after the expiry date, then assigning a status of expired if it is, else seeing if today is after the warning date, then assigning a status of close to expired, otherwise not expired

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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