Forum Discussion
gujralh
2 years agoHelper I
How to create the measure for getting the Value difference between 2 dates
Hi All Please help me in creating the measure for getting the value difference between 2 dates i.e Existing date with last 7th date. Here in below table values against each date is also a mea...
- Anonymous2 years ago
Hi gujralh ,
Thank you for your reply.
Please create the following two measures to show the value difference and % value difference for dates every seven days:
Measure_Difference_7Days = VAR CurrentDate = MAX('Table'[Date_ID]) VAR PreviousDate = CurrentDate - 6 VAR MeasureCurrent = [Measure1] VAR MeasurePrevious = CALCULATE( [Measure1], FILTER( ALL('Table'), 'Table'[Date_ID] = PreviousDate ) ) RETURN IF( ISBLANK(MeasurePrevious), BLANK(), MeasureCurrent - MeasurePrevious )Measure_Difference_Percentage_7Days = VAR CurrentDate = VALUE(MAX('Table'[Date_ID])) VAR PreviousDate = CurrentDate - 6 VAR MeasureCurrent = [Measure1] VAR MeasurePrevious = CALCULATE( [Measure1], FILTER( ALL('Table'), VALUE('Table'[Date_ID]) = PreviousDate ) ) VAR MeasureDifference = IF( ISBLANK(MeasurePrevious), BLANK(), MeasureCurrent - MeasurePrevious ) RETURN MeasureDifference / MeasurePreviousResult for your reference:
Best regards,
Joyce
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
2 years agoNot applicable
Hi gujralh ,
Thank you for your reply.
Please create the following two measures to show the value difference and % value difference for dates every seven days:
Measure_Difference_7Days =
VAR CurrentDate = MAX('Table'[Date_ID])
VAR PreviousDate = CurrentDate - 6
VAR MeasureCurrent = [Measure1]
VAR MeasurePrevious =
CALCULATE(
[Measure1],
FILTER(
ALL('Table'),
'Table'[Date_ID] = PreviousDate
)
)
RETURN
IF(
ISBLANK(MeasurePrevious),
BLANK(),
MeasureCurrent - MeasurePrevious
)
Measure_Difference_Percentage_7Days =
VAR CurrentDate = VALUE(MAX('Table'[Date_ID]))
VAR PreviousDate = CurrentDate - 6
VAR MeasureCurrent = [Measure1]
VAR MeasurePrevious =
CALCULATE(
[Measure1],
FILTER(
ALL('Table'),
VALUE('Table'[Date_ID]) = PreviousDate
)
)
VAR MeasureDifference =
IF(
ISBLANK(MeasurePrevious),
BLANK(),
MeasureCurrent - MeasurePrevious
)
RETURN
MeasureDifference / MeasurePrevious
Result for your reference:
Best regards,
Joyce
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
gujralh
2 years agoHelper I
Thanks much Anonymous, works well for me now!