Hello,
I have a measure like this:
Days Change Previous Report =
VAR vThisCompDate =
MIN ( Backlog[End Date (Ops)] )
VAR vThisReportDate =
MIN ( Backlog[Report Date] )
VAR vPrevCompDate =
CALCULATE (
LASTNONBLANKVALUE (
Backlog[Report Date],
MIN ( Backlog[End Date (Ops)] )
),
ALLEXCEPT (
Backlog,
Backlog[Project],
Backlog[Customer],
Backlog[Job Site]
),
Backlog[Report Date] < vThisReportDate
)
VAR DaysDiff = DATEDIFF (
vPrevCompDate,
vThisCompDate,
DAY
)
RETURN
DaysDiff
However, it doesn’t sum correctly the days of difference, please see below screen. Does anyone know how to fix it?
Here is the pbix file, I have created a new “fake” dataset. However, it seems that the days are not added at all now.
My goal would be to see the total days of difference, which will help me to understand what was the total days difference by customer (for example).
thank you,
Marek
Pbi_dset.pbix (85.2 KB)
Harsh
December 21, 2020, 10:44am
2
Hello @marek.regulski ,
Thank You for posting your query onto the Forum.
Can you please upload the working of your PBIX file for the reference? So that the members of our forum can assist you in a better manner and provide you the results more efficiently.
Thanks and Warm Regards,
Harsh
1 Like
Harsh
December 21, 2020, 11:30am
4
Hello @marek.regulski ,
Thank You for providing the working PBIX file.
Well I just wrote one more small formula in order to have the grand totals. Below is the formula provided for the reference -
Days Change Previous Report - Harsh =
SUMX(
SUMMARIZE(
Pbi ,
Pbi[Project No.] ,
Pbi[Job Site] ,
Pbi[Source.Name] ,
Pbi[End Date (Ops)] ) ,
[Days Change Previous Report]
)
I’m also providing a link below where one of our expert @Greg had put up a great post about “How To Fix The Totals ”.
As well as also attaching the working of my PBIX file for the reference.
Hoping you find this useful and meets your requirements that you’ve been looking for.
Thanks and Warm Regards,
Harsh
Pbi_dset - Harsh.pbix (85.3 KB)
When using a measure column in a visual, it is not uncommon in Power BI to find that the totals are incorrect. The Fix Incorrect Totals DAX pattern can be used to correct this issue.
When a DAX measure is providing the correct detail value it often, unfortunately, provides an incorrect value for the total row. This is due to there being no evaluation context for the total row. For example, when comparing the [Total Sales] to the [Sales LY] to find the minimum for a customer using the simple DAX…
1 Like
Harsh:
SUMX(
SUMMARIZE(
Pbi ,
Pbi[Project No.] ,
Pbi[Job Site] ,
Pbi[Source.Name] ,
Pbi[End Date (Ops)] ) ,
[Days Change Previous Report]
)
It works!
Thank you so much for such a detailed answer and further materials. This is great.
Harsh
December 21, 2020, 11:46am
6
Hello @marek.regulski ,
You’re Welcome.
I’m glad that I was able to help you and you found it useful.
Thanks and Warm Regards,
Harsh