Forum Discussion
Calculate difference of data from previous available date
- 4 years ago
just, a bit editing))
below script is work
Daily Billed =
VAR PrevDate =
MAXX(
FILTER(
ALL('Data'[Dump Date]),
'Data'[Dump Date] < max('Data'[Dump Date])
),
'Data'[Dump Date]
)
VAR PreBilled_perivous =
CALCULATE(
[Billed Emp],
'Data'[Dump Date]=PrevDate
)VAR result = [Billed Emp]-PreBilled_perivous
return result - 4 years ago
Hi, Powerful
Please try the following methods. The calculation starts with Billed Emp as the measure.
PreBilled = Var PrevDate=MAXX(FILTER(ALL('Data'[Date]),'Data'[Date]<SELECTEDVALUE('Data'[Date])),'Data'[Date]) Var PreBilled=CALCULATE([Billed Emp],FILTER(ALL(Data),[Date]=PrevDate)) Return PreBilledDaily Billed = IF([PreBilled]<>BLANK(),[Billed Emp]-[PreBilled],BLANK())Is this the output you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks SolomonovAnton
I have tried this.
This is giving the same data as [Billed Emp]. it is taking PreBilled_perivous as Zero hence [Billed Emp]-PreBilled_perivous same as [Billed Emp].
Thanks!!
just, a bit editing))
below script is work
Daily Billed =
VAR PrevDate =
MAXX(
FILTER(
ALL('Data'[Dump Date]),
'Data'[Dump Date] < max('Data'[Dump Date])
),
'Data'[Dump Date]
)
VAR PreBilled_perivous =
CALCULATE(
[Billed Emp],
'Data'[Dump Date]=PrevDate
)
VAR result = [Billed Emp]-PreBilled_perivous
return result