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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Find the number of days for a task to close

Hello,

 

I apologize if this question is previously asked. Here is my doubt. 

I have a discrepancy open date and discrepancy closed date. If the discrepancy is not resolved, the closed date is blank but if it is, there is a value for it. In the table below, I want to add a column that tells since how many days and months (2 separate columns for month and days will also work) is the discrepancy still open.

 

The image below shows the most recent data, but we have instances where discrepancies are open for months and I'd like to color code them (eg, if case is open for less than 1 month, then green, it is between 1-3 months then yellow, if open beyond 3 months, then red)

 

Really appreciate any help

 

Capture.PNG

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Anonymous  ,

Here are the steps you can follow:
If a discrepancy is still open, it doesn't show up:

1. You can change your function to the following style:

Column 2 =
iF(ISBLANK([Discrepancy.CloseDateTime]), DATEDIFF([Discrepancy.OpenDateTime], TODAY(),DAY), BLANK())

Result:

v-yangliu-msft_0-1615164115938.jpeg

Color the required datediff:

1. Select column Datediff-select Conditional formatting-Background color

v-yangliu-msft_1-1615164115943.png

2. In the Background color interface, Format by selects Rules, Based on field selects datediff, and then color labels according to the rules

v-yangliu-msft_2-1615164115945.png

3. Result:

v-yangliu-msft_3-1615164115949.png

You can downloaded PBIX file from here.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi  @Anonymous  ,

Here are the steps you can follow:
If a discrepancy is still open, it doesn't show up:

1. You can change your function to the following style:

Column 2 =
iF(ISBLANK([Discrepancy.CloseDateTime]), DATEDIFF([Discrepancy.OpenDateTime], TODAY(),DAY), BLANK())

Result:

v-yangliu-msft_0-1615164115938.jpeg

Color the required datediff:

1. Select column Datediff-select Conditional formatting-Background color

v-yangliu-msft_1-1615164115943.png

2. In the Background color interface, Format by selects Rules, Based on field selects datediff, and then color labels according to the rules

v-yangliu-msft_2-1615164115945.png

3. Result:

v-yangliu-msft_3-1615164115949.png

You can downloaded PBIX file from here.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Anonymous
Not applicable

I created a new column called Datediff and this is the formula - 

datediff = IF(ISBLANK(Discrepancy[Discrepancy.CloseDateTime]), DATEDIFF(Discrepancy[Discrepancy.OpenDateTime], TODAY(),DAY), DATEDIFF(Discrepancy[Discrepancy.OpenDateTime], Discrepancy[Discrepancy.CloseDateTime],DAY))
 
The issue with this formula is - if a discrepancy is still open, it doesn't show up. I think it has something to do with isblank. What I'm basically trying is to say that if the column Discrepancy.DiscrepancyClosedDateTime is blank, then datediff is OpenedDate - Today. 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.