Forum Discussion

nardtmo's avatar
nardtmo
Icon for Helper III rankHelper III
7 years ago
Solved

Need help weekly time base comparison power bi

  Hello All,   monitoring per hour and need to get the difference between today and last week same hour. see sample data below.       
  • Mariusz's avatar
    7 years ago

    Hi nardtmo 

    You can add a column with below DAX Expression.

    Column = 
    VAR pwd = DATEADD( YourTable[Date], -7, DAY )
    RETURN 
    YourTable[Books] -
    CALCULATE(
        SUM( YourTable[Books] ),
        ALLEXCEPT( YourTable, YourTable[Student ID], YourTable[Hour] ),
        YourTable[Date] = pwd
    )

    Regards,
    Mariusz

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.