Forum Discussion
table visual rows increasing drastically after adding a measure
Hi,aatish178
Regarding the issue you raised, my solution is as follows:
1. Below are the measure I've created for your needs:
Measure =
var MaxDate=MAX(Table1[Date])
Var LatestValidFrom=FILTER(ALL('Table2'),Table2[EmpNo]=MAX(Table2[EmpNo]) && Table2[CompCode]=MAX(Table2[CompCode])
&& Table2[CompNo]=MAX(Table2[CompNo]) && Table2[Valid From]<=MaxDate)
Return
CALCULATE(MAX(Table2[Valid To]),LatestValidFrom)
2.You can perform performance checks in the following places in your desktop.
Here are the results of the code you provided:
Here are the measured results from the code I provided:
Here's the result of the optimization of the second metric you provided:
Measure 2 =
VAR To1=[Latest Valid To atest Valid To]
RETURN if(MAX(Table2[Valid To])=To1, 1 ,BLANK())
Of course, you can also use the SUMMARIZE() function to aggregate what you need in advance, thus reducing duplicate budgets.
3.Here is the relevant documentation:
SUMMARIZE function (DAX) - DAX | Microsoft Learn
Optimization guide for Power BI - Power BI | Microsoft Learn
Please find the attached pbix relevant to the case.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Leory,
Thanks for your help, however using All function will not help, because if user selects some old dates from Valid From Slicers then Latest version will not get calculate on that selection and table will show blank result, to fix this I have used AllSelected