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
e2hass
Frequent Visitor

is there a date difference in weeks/months visual?

Hi,

 

Is there a visual which shows the difference between two dates in weeks/months etc?

 

What i want to do is have like a card view and show delay in a project completion date. Cant seem to work out how to display such data. my table data looks something like below:

 

 

Project NoPlanned CompletionForecasted CompletionVariance in weeks
1a01/07/201607/07/20161
7c10/06/201624/06/20162
1 ACCEPTED SOLUTION
v-haibl-msft
Employee
Employee

@e2hass

 

Not sure if the columns of “Variance in weeks” and “Variance in months” exist in your original dataset. If no, we can create two columns with following formulas.

Variance in weeks = DATEDIFF ( Table1[Planned Completion], Table1[Forecasted Completion], WEEK )
Variance in months = DATEDIFF ( Table1[Planned Completion], Table1[Forecasted Completion], MONTH )

is there a date difference in weeksmonths visual_1.jpg

 

Then drag Slicer (Project No for Field) and Card chart into your canvas. The card will show the delay when you select a project in the slicer.

is there a date difference in weeksmonths visual_2.jpg

 

Best Regards,

Herbert

View solution in original post

3 REPLIES 3
v-haibl-msft
Employee
Employee

@e2hass

 

Not sure if the columns of “Variance in weeks” and “Variance in months” exist in your original dataset. If no, we can create two columns with following formulas.

Variance in weeks = DATEDIFF ( Table1[Planned Completion], Table1[Forecasted Completion], WEEK )
Variance in months = DATEDIFF ( Table1[Planned Completion], Table1[Forecasted Completion], MONTH )

is there a date difference in weeksmonths visual_1.jpg

 

Then drag Slicer (Project No for Field) and Card chart into your canvas. The card will show the delay when you select a project in the slicer.

is there a date difference in weeksmonths visual_2.jpg

 

Best Regards,

Herbert

@v-haibl-msft

 

Thanks for your reply. The calculated columns do not work for negative weeks. Sometimes Forecasted could be before Planned. DATEDIFF throws error saying start date must be greater then date. Do you know what function i can use to solve this? or shall i just leave this at the datasource... 

 

overall perfect solution. 

@e2hass

 

We can use IF function to solve it.

 

Variance in weeks = 
IF (
    Table1[Forecasted Completion] >= Table1[Planned Completion],
    DATEDIFF ( Table1[Planned Completion], Table1[Forecasted Completion], WEEK ),
    - DATEDIFF ( Table1[Forecasted Completion], Table1[Planned Completion], WEEK )
)

 

Variance in months = 
IF (
    Table1[Forecasted Completion] >= Table1[Planned Completion],
    DATEDIFF ( Table1[Planned Completion], Table1[Forecasted Completion], MONTH ),
    - DATEDIFF ( Table1[Forecasted Completion], Table1[Planned Completion], MONTH )
)

 

Best Regards,

Herbert

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.

Top Solution Authors