Forum Discussion

xzfujc's avatar
xzfujc
Frequent Visitor
7 years ago
Solved

Calculated Table for Month over Month Changes

Hello,   I have an archive table that looks like the following:   Gate Emp. ID Count Month Year IA a123 351 9 2018 IRA a123 220 9 2018 NEW a123 26 9 2018 PSA a123 ...
  • dedelman_clng's avatar
    7 years ago

    Hi xzfujc

     

    The best way is to think of measures instead of tables/columns.  You can then calculate the number of gates for the given month, the number of gates for the previous month, and then the difference.

     

    You will need a date column to key off of, but since you have Month and Year, that's easy enough to create.

     

     

    //Calculated Column
    Dt = DATE(Year, Month, 1)
    
    //Measures
    Total Gates = CALCULATE(SUM(Count))
    
    LM Total Gates = CALCULATE([Total Gates], PREVIOUSMONTH(Dt))
    
    Variance = [Total Gates] - [LM Total Gates]

     

    This will allow you to create a table visual, and if you want to look at it by just Gate instead of by Gate and Emp ID, the calculation will take care of itself.

     

    Hope this helps

    David