Forum Discussion
Calculated Table for Month over Month Changes
- 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
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
I can't explain it, but adding the .[Date] to the Dt field solved my problem. After adding the .[Date], the LM value was calculated correctly.
LM Total Gates = CALCULATE([Total Gates], PREVIOUSMONTH('Gates Count Archive'[Dt].[Date]))
Thanks for all your help!