Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I'm trying to figure out what is affecting calculations on the visual and lead to inconsistent behaviour.
The measure displays values for some teams but not for the other
However if I add to the visual date parameter, or other smaller granularity value from dimension it calculates correctly.
DAX is
CALCULATE(
AVERAGE('Fact Table'[MeasureValue]),
FILTER('Fact Table','Fact Table'[ReportingStartDateKey] = MAX('Fact table'[ReportingStartDateKey])),
FILTER('Fact Table','Fact Table'[MeasureKey]=83)
)
Usage of MAX Function in FILTER: The MAX function inside the FILTER function is evaluating the maximum value of 'Fact Table'[ReportingStartDateKey] for the entire table, not per the current filter context established by CALCULATE. If you intend to compare each row's [ReportingStartDateKey] against the maximum date in the table, this is correct. However, if your intention was to dynamically determine the maximum date based on other filters applied outside this CALCULATE, then you should consider calculating the max date in a variable first, or ensure the context in which the CALCULATE function is executed provides the right scope.
Nested FILTER Functions: The FILTER functions are applied as separate arguments to CALCULATE, which means they each independently filter the 'Fact Table'. DAX will intersect these filters, so the result will be filtered by both the maximum [ReportingStartDateKey] and [MeasureKey] = 83. This is typically correct, but it's important to ensure this is the desired behavior.
Performance Considerations: Using FILTER with MAX inside the CALCULATE function can be less performant on large datasets because FILTER evaluates row by row. Consider pre-calculating values or using a more direct filtering approach if performance is an issue.
Assuming the goal is to average the MeasureValue for the latest reporting start date where the MeasureKey is 83...
Here's the revised version of your DAX formula:
VAR MaxStartDateKey = CALCULATE(
MAX('Fact Table'[ReportingStartDateKey]),
ALL('Fact Table')
)
RETURN
CALCULATE(
AVERAGE('Fact Table'[MeasureValue]),
'Fact Table'[ReportingStartDateKey] = MaxStartDateKey,
'Fact Table'[MeasureKey] = 83
)
Proud to be a Super User!
Hi thank you for your comment, much appreciated. Previosuly I had a measure with variables, however it was slow and can't bring info from more than 7 dimensions. Removing variable and wrapping in filter resolved the issue.
This is how one of the previous measure was:
VAR CurrentDate = MAX('Fact Table'[ReportingStartDateKey])
VAR Result = CALCULATE(COUNTROWS('Fact Table'),
'Fact Table'[ReportingStartDateKey]=CurrentDate,
'Fact Table'[MeasureKey]=56)
RETURN Result
I do like how readable measures with variables, but unfortunately in this case it runs much slower than with filters.
Thank you for your explanation it is actually gives me the idea why data is inconsistently displaying in current DAX when there is no date present.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
8 | |
8 | |
7 |
User | Count |
---|---|
13 | |
12 | |
11 | |
10 | |
8 |