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
Here's a simple example to illustrate my problem. Here's the model:
Here are the rows in the "fact" table:
My goal is to display the order value, by product, in the latest month selected in a slicer. For example, if the Date slicer is between Jan 1 2025 and March 1 2025, then the matrix should look like this:
LatestOrderValue is defined like this:
If I remove the ProductID "row" from the matrix, I get the expected value which is 56:
Solved! Go to Solution.
Hi,
Please check the below picture and the attached pbix file.
I think, we can try to use columns from dimension table in the CALCULATE function.
In the latest month order value: =
VAR _latestdate =
MAX ( 'date'[Date] )
VAR _latestmonth =
EOMONTH ( _latestdate, 0 )
RETURN
CALCULATE ( SUM ( 'order'[value] ), EOMONTH ( 'date'[Date], 0 ) = _latestmonth )
Based on your scenario, here are a few thoughts from my end that might help clarify the behavior:
Hope this helps!!
@Jihwan_Kim many thanks for the effort to analyze and propose a solution. As you saw in my original message, I too had similar workarounds in place which are working for me. My main question is that of understanding the difference between why having an explicit variable for the max data outside of the CALCULATE, works, while having basically the same expression as a filter inside the CALCULATE, does not. In my model, the Date dimension filters the fact table with a 1-way relationship; so my presumption is that asking for the LASTDATE of selected values for that Date dimension, would have worked correctly and always return the "max data" regardless of the context (variable outside, or inline inside the CALCULATE). This is the core question. Thanks again for your help!
Based on your scenario, here are a few thoughts from my end that might help clarify the behavior:
Hope this helps!!
Hi,
Please check the below picture and the attached pbix file.
I think, we can try to use columns from dimension table in the CALCULATE function.
In the latest month order value: =
VAR _latestdate =
MAX ( 'date'[Date] )
VAR _latestmonth =
EOMONTH ( _latestdate, 0 )
RETURN
CALCULATE ( SUM ( 'order'[value] ), EOMONTH ( 'date'[Date], 0 ) = _latestmonth )
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 14 | |
| 5 | |
| 5 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 24 | |
| 10 | |
| 10 | |
| 6 | |
| 6 |