Forum Discussion

echaize's avatar
echaize
Frequent Visitor
2 years ago
Solved

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...
  • parry2k's avatar
    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 ) )