Forum Discussion
is there a date difference in weeks/months visual?
- 10 years ago
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 )
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.
Best Regards,
Herbert
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 )
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.
Best Regards,
Herbert
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.
- v-haibl-msft10 years agoMicrosoft Employee
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