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
Julian_HH
Regular Visitor

Calculating date difference from today to determine Status

Hi all,

I have a dataset where I need to calculate and highlight jobs that has not started and has the below criteria:

- They are within 2 to 3 weeks from the [Expected Delivery Date] (EDD).
- They are within 1 week from the EDD, or doesn't have another date entered [HandIn Date]
- There are less than 80% of the [Ordered Quantity] in the [Warehouse Stock], on or after the EDD

I have tried creating a Calculated Column using DATEDIFF to subtract the EDD and TODAY() to get a number then use that to filter out my results, but no luck.

What might be other ways of getting around to do the above? I am relatively new to PowerBI, and would like to learn more about the tool. Thanks!

Julian

1 ACCEPTED SOLUTION

Hi @Julian_HH,

 

If I understand you correctly, you should be able to use the formulas below to add three calculate columns in your table to indicate it is Alert 1, Alert 2, and Alert 3. Then use the the three calculate columns as Slicers on your report. Smiley Happy

IsAlert1 = 
IF (
    Main[Expected Delivery Date] - Main[Work Start Date 1]
        > 21
        && Main[Expected Delivery Date] - Main[Work Start Date 2]
        > 21,
    1,
    0
)
IsAlert2 = 
IF (
    Main[Expected Delivery Date] - Main[Work Start Date 1]
        > 7
        && Main[Expected Delivery Date] - Main[Work Start Date 2]
        > 7
        && Main[Expected Delivery Date] - Main[HandIn Date 1]
        > 7
        && Main[Expected Delivery Date] - Main[HandIn Date 2]
        > 7,
    1,
    0
)
IsAlert3 =
IF (
    ( Main[Packed Stock] + Main[Warehouse Stock] )
        < Main[Order Quantity] * 0.8,
    1,
    0
)

r2.PNG

 

Here is modified pbix file for your reference. Smiley Happy

 

Regards

View solution in original post

4 REPLIES 4
v-ljerr-msft
Employee
Employee

Hi @Julian_HH,

 

Could you post your table structures with some sample/dummy data and your expected result, so that we can better assist on this issue? It's better to share a sample pbix file. You can upload it to OneDrive or Dropbox and post the link here. Do mask sensitive data before uploading. Smiley Happy

 

Regards

Hi @v-ljerr-msft,

 

Thank you for replying, here's a link to the .pbix file. I have tried filtering out non-related columns and data, hope I didn't miss anything.

 

To clarify, what I would like to do is to mainly work from the "Expected Delivery Date" & "Work Start Date". The conditions I want to highlight:

 

- If there is no "Work Start Date" 3 weeks from the "Expected Delivery Date", then mark that as Alert 1.

If there is no "Work Start Date" or "HandIn Date" 1 week from the "Expected Delivery Date", then mark that as Alert 2.

- If there are less than 80% of the "Ordered Quantity" in the "Packed Stock" & "Warehouse Stock" on or after the "Expected Delivery Date", then mark that as Alert 3.

 

I would like the result to be in a table form, so that I could use conditional formatting based on the Alerts. 

 

Sorry if I'm not clear enough! Thanks!

 

Julian

 

 

Hi @Julian_HH,

 

If I understand you correctly, you should be able to use the formulas below to add three calculate columns in your table to indicate it is Alert 1, Alert 2, and Alert 3. Then use the the three calculate columns as Slicers on your report. Smiley Happy

IsAlert1 = 
IF (
    Main[Expected Delivery Date] - Main[Work Start Date 1]
        > 21
        && Main[Expected Delivery Date] - Main[Work Start Date 2]
        > 21,
    1,
    0
)
IsAlert2 = 
IF (
    Main[Expected Delivery Date] - Main[Work Start Date 1]
        > 7
        && Main[Expected Delivery Date] - Main[Work Start Date 2]
        > 7
        && Main[Expected Delivery Date] - Main[HandIn Date 1]
        > 7
        && Main[Expected Delivery Date] - Main[HandIn Date 2]
        > 7,
    1,
    0
)
IsAlert3 =
IF (
    ( Main[Packed Stock] + Main[Warehouse Stock] )
        < Main[Order Quantity] * 0.8,
    1,
    0
)

r2.PNG

 

Here is modified pbix file for your reference. Smiley Happy

 

Regards

Hi @v-ljerr-msft,

 

This is great! Thanks a lot! Smiley Very Happy

 

 

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.