Forum Discussion
echaize
2 years agoFrequent Visitor
Calculate period over period
Hello, I'm trying to calculate and compare two measures. The first "Qty Sum" is the SUM of my fact table on a period defined by a "between" date sclicer and the second is the same measure on the pr...
- 2 years ago
echaize you have to remove the row filter context coming because you are showing date column on the row and that's why:
it should be something like this:
Qty Sum PP = VAR __StartDate = CALCULATE ( MIN ( Dates[Date] ), ALLSELECTED ( Dates[Date] ) ) VAR __EndDate = CALCULATE ( MAX ( Dates[Date] ), ALLSELECTED ( Dates[Date] ) ) VAR __Days = DATEDIFF ( __EndDate, __StartDate, DAY ) - 1 RETURN CALCULATE ( [Qty Sum], DATEADD ( Dates[Date], __Days, DAY ) )
parry2k
Super User
2 years agoechaize you have to remove the row filter context coming because you are showing date column on the row and that's why:
it should be something like this:
Qty Sum PP =
VAR __StartDate = CALCULATE ( MIN ( Dates[Date] ), ALLSELECTED ( Dates[Date] ) )
VAR __EndDate = CALCULATE ( MAX ( Dates[Date] ), ALLSELECTED ( Dates[Date] ) )
VAR __Days = DATEDIFF ( __EndDate, __StartDate, DAY ) - 1
RETURN
CALCULATE ( [Qty Sum], DATEADD ( Dates[Date], __Days, DAY ) )