Forum Discussion
PBI ON REFRESH - 'The MAX function only accepts a column reference as the argument number 1.
- 1 year ago
Thankyou, Ritaf1983, for your response.
Hi FabricNZ,We appreciate your inquiry on the Microsoft Fabric Community Forum.
From my understanding, the error message indicates an incorrect DAX syntax involving the use of MAX(<expression>), where MAX is applied to a scalar or measure instead of a column reference. This issue does not appear in visuals, is not flagged within Power BI Desktop, and only occurs during Semantic Model refresh. This suggests that the problem likely lies within a calculated column, calculated table, or a hidden expression within the model.
Moreover, the memory overflow indicates that a complex or improperly scoped calculation — possibly recursive or involving a very large row context — is attempting to process extensive datasets during the refresh.
Kindly follow the steps below to help resolve this issue:
-
The error is caused by using MAX() with a measure or a missing column (for example, [Total]). Since this is not evident in the UI, you can locate the erroneous MAX usage by:
a. Opening your .pbip project folder.
b. Navigate to expressions.json. Search for MAX( and Total. You will likely find a broken expression such as MAX([Total]), where [Total] is not a column. -
Ensure that MAX() is used exclusively with column references to correct the DAX expression.
The expression MAX([Total]) — if [Total] is a measure or a deleted column — is incorrect. The correct usage should be MAX(Sales[TotalAmount]). -
To avoid memory overflow issues, apply the following changes:
a. In Power Query, apply row filters such as Table.SelectRows(Source, each [Date] >= #date(2024,1,1]) and use Table.FirstN(Source, 100) for testing purposes.
b. Disable Auto Date/Time from File > Options > Data Load.
c. Remove unused columns and tables, and disable table load if not required. -
Test the changes in Power BI Desktop, re-publish to Power BI Service / Fabric, and re-enter the data source credentials. If memory limits persist, request a per-query memory increase from the capacity administrator (applicable for Premium/Fabric SKUs).
Additionally, please refer to the following links for further information:
MAX function (DAX) - DAX | Microsoft Learn
Optimization guide for Power BI - Power BI | Microsoft LearnShould you find our response helpful, kindly mark it as the accepted solution and provide kudos. This will assist other community members who face similar issues.
For any further queries, please feel free to contact the Microsoft Fabric community.
Thank you.
-
Thanks all for your response. I started a fresh and rebuilt the dashboard using TDML, etc in a few hours and it works again. I did find the total error. The MAX has disappeared. I feel there was something corrupt within the workbook as the same joins and queries are there again. All very strange and unusual. The problem is too I can't on some pages restrict the date on initial load or filters as the page represents historical trends for which I need the full data. Thank you all again. Whilst no one solution helped, the ideas did.