Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I am comparing overtime per month at 100+ locations, the OT and OT last month update when slicer / filter by location is selected, however the variance and variance % do not reflect the change. It continues to return total value of OT for the entire month for all locations.
How can I fix my formula to update by location when filtered for accurate reporting?
Solved! Go to Solution.
Hi @MesserAmericas,
You can try to use the following formula to extract the current date value to calculate.
formula =
VAR currDate =
MAX ( 'Date'[Date] )
VAR prevDate =
DATE ( YEAR ( currDate ), MONTH ( currDate ) - 1, DAY ( currDate ) )
VAR cmOT =
SUM ( Table[OT] )
VAR pmOT =
CALCULATE (
SUM ( Table[OT] ),
FILTER (
ALLSELECTED ( Table ),
YEAR ( [Date] ) = YEAR ( prevDate )
&& MONTH ( [Date] ) = MONTH ( prevDate )
)
)
RETURN
cmOT - pmOT
Regards,
Xiaoxin Sheng
Try the following:
Sum OT = SUM (Table[OT])
Prev Month OT = CALCUALTE([Sum OT], DATEADD(Date Table[Date], -1, DAY))
OT Month Var = [Sum OT] - [Prev Month OT]
Proud to be a Super User!
Paul on Linkedin.
how is the model set up? Do you have a Date Table?
Proud to be a Super User!
Paul on Linkedin.
Yes I have a date table.
Were you able to understand the sample data. My formula does not contain any notes regarding Filter. I am new to power BI
please provide sample data or PBIX file, a depcition of the expected output and the code for the measure you have
Proud to be a Super User!
Paul on Linkedin.
Sample data OT by month, when slicing by location the variance pulls entire total.
| Month | Location | OT |
| January | LocA | 500 |
| January | LocB | 1300 |
| January | LocC | 1100 |
| January | LocD | 200 |
| January | LocE | 0 |
| January | LocF | 1700 |
| February | LocA | 0 |
| February | LocB | 2500 |
| February | LocC | 7000 |
| February | LocD | 2 |
| February | LocE | 1600 |
| February | LocF | 400 |
| March | LocA | 600 |
| March | LocB | 1000 |
| March | LocC | 0 |
| March | LocD | 500 |
| March | LocE | 250 |
| March | LocF | 500 |
Formula : OT MoM Var = OT Last Month - OT Sum
Hi @MesserAmericas,
You can try to use the following formula to extract the current date value to calculate.
formula =
VAR currDate =
MAX ( 'Date'[Date] )
VAR prevDate =
DATE ( YEAR ( currDate ), MONTH ( currDate ) - 1, DAY ( currDate ) )
VAR cmOT =
SUM ( Table[OT] )
VAR pmOT =
CALCULATE (
SUM ( Table[OT] ),
FILTER (
ALLSELECTED ( Table ),
YEAR ( [Date] ) = YEAR ( prevDate )
&& MONTH ( [Date] ) = MONTH ( prevDate )
)
)
RETURN
cmOT - pmOT
Regards,
Xiaoxin Sheng
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 103 | |
| 80 | |
| 59 | |
| 51 | |
| 46 |