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!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
Hello, I am using the following DAX expression, which works as intended with the correct filtering:
Solved! Go to Solution.
When you use `TODAY()`, it's straightforward because it always returns the current date, regardless of any filter context. However, when you use `MAX(Gains[Effective Date])`, the result depends on the current filter context.
To ensure that `MAX` calculates the maximum date over the entire `Gains` table, regardless of any filters that might be applied elsewhere in your report or calculations, you can use the `ALL` function to remove any filters from the `Gains[Effective Date]` column. Here's how you can modify your measure:
Count =
VAR _latestDate = CALCULATE(MAX(Gains[Effective Date]), ALL(Gains))
VAR _start = EOMONTH(_latestDate, -4)
VAR _result = CALCULATE(COUNTROWS(Gains), Gains[Effective Date] >= _start)
RETURN _result
Proud to be a Super User!
When you use `TODAY()`, it's straightforward because it always returns the current date, regardless of any filter context. However, when you use `MAX(Gains[Effective Date])`, the result depends on the current filter context.
To ensure that `MAX` calculates the maximum date over the entire `Gains` table, regardless of any filters that might be applied elsewhere in your report or calculations, you can use the `ALL` function to remove any filters from the `Gains[Effective Date]` column. Here's how you can modify your measure:
Count =
VAR _latestDate = CALCULATE(MAX(Gains[Effective Date]), ALL(Gains))
VAR _start = EOMONTH(_latestDate, -4)
VAR _result = CALCULATE(COUNTROWS(Gains), Gains[Effective Date] >= _start)
RETURN _result
Proud to be a Super User!
Brilliant! This did the trick - thank you so much!
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 57 | |
| 55 | |
| 42 | |
| 16 | |
| 16 |
| User | Count |
|---|---|
| 113 | |
| 108 | |
| 38 | |
| 35 | |
| 26 |