Forum Discussion
Analitika
6 years agoPost Prodigy
MAX return wrong results
I have Table1 OpNr | ApNr | Sum | Date 123 | 456 | 300 | 2019-07-17 123 | 856 | 50 | 2019-08-07 Expected result ApNr | TotalSumByOpNr | MaxDate 456 | 350 | 2019-08-07 856 | 350 | 2019-08-0...
- 6 years ago
Hi, Analitika
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Table1:
You may create two measures as below.
TotalSumByOpNr = var tab = SUMMARIZE( Table1, Table1[ApNr], "Result1", var _opnr = SELECTEDVALUE(Table1[OpNr]) return CALCULATE( SUM(Table1[Sum]), FILTER( ALL(Table1), Table1[OpNr]=_opnr ) ) ) return MAXX( tab, [Result1] )MaxDate = var tab = SUMMARIZE( Table1, Table1[ApNr], "Result2", var _opnr = SELECTEDVALUE(Table1[OpNr]) return CALCULATE( MAX(Table1[Date]), FILTER( ALL(Table1), Table1[OpNr]=_opnr ) ) ) return IF( ISFILTERED(Table1[ApNr]), MAXX( tab, [Result2] ) )Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
vanessafvg
6 years agoCommunity Champion
please can you give more information, its hard to understand what you are doing, what result is it returning, how are you running this calculation, do you have some data to share?