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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
This is driving me mad. I want to be able to use a seperate metric for the most recent month. I've got the below calculation and it's working for the most recent period but not for the previous one.
Measure =
VAR MaxMonth = CALCULATE(MAX('Calendar'[FISCAL_PERIOD]), 'OPS_BONUS MANUAL_TECHNICIAN_IO_VW'[BONUS_PAYMENT] > 0)
VAR BonusCurrent = sum('OPS_BONUS MANUAL_TECHNICIAN_IO_VW'[BONUS_PAYMENT])
VAR BonusPrevious = SUM('OPS_BONUS MANUAL_TECHNICIAN_VIEW_TECH_OPTI_WEEKLY_SNAPSHOT_VW'[Column])
RETURN
IF(VALUES('Calendar'[FISCAL_PERIOD]) = MaxMonth, BonusCurrent, BonusPrevious)
Try this measure:
Bonus Measure =
VAR MaxMonth =
CALCULATE (
MAX ( 'Calendar'[FISCAL_PERIOD] ),
ALL ( 'Calendar' ),
'OPS_BONUS MANUAL_TECHNICIAN_IO_VW'[BONUS_PAYMENT] > 0,
CROSSFILTER ( 'Calendar'[Date], 'OPS_BONUS MANUAL_TECHNICIAN_IO_VW'[Date], BOTH )
)
VAR BonusCurrent =
SUM ( 'OPS_BONUS MANUAL_TECHNICIAN_IO_VW'[BONUS_PAYMENT] )
VAR BonusPrevious =
SUM ( 'OPS_BONUS MANUAL_TECHNICIAN_VIEW_TECH_OPTI_WEEKLY_SNAPSHOT_VW'[Column] )
RETURN
IF ( MAX ( 'Calendar'[FISCAL_PERIOD] ) = MaxMonth, BonusCurrent, BonusPrevious )
I'm assuming that you have a "1:*" unidirectional relationship between Calendar and each fact table using the Date column. The CROSSFILTER function allows you to filter from the fact table to the Calendar table. The ALL function clears the Calendar filter context in the visual. Also, in the final line I changed VALUES to MAX. VALUES returns a table, and you can't compare a table to a scalar.
Proud to be a Super User!
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 39 | |
| 38 | |
| 38 | |
| 28 | |
| 27 |
| User | Count |
|---|---|
| 124 | |
| 88 | |
| 73 | |
| 66 | |
| 65 |