Forum Discussion
Tito
2 years agoHelper IV
Calculate Sum MAX
Hello everyone, Can someone please help me how to calculate the maximum of Sales. See the data below: Data: Result: Best regards Tito
- 2 years ago
Hi Tito,
Please try this formula:MAX Measure = VAR _Table = ADDCOLUMNS( SUMMARIZE( T_MaxQ, T_MaxQ[Name], T_MaxQ[ID] ), "@MaxSales", VAR _MAX = CALCULATE(MAX(T_MaxQ[Date])) VAR _Result = CALCULATE( SUM(T_MaxQ[Sales]), T_MaxQ[Date] = _MAX ) RETURN _Result ) VAR _Result = SUMX(_Table, [@MaxSales]) RETURN _Result
Tito
2 years agoHelper IV
Hi DataNinja777 ,
Thank you for your reply.
If I select name "A", 30 should be returned.
I want the sum sales by maximum of date and not the maximum of sales.
DataNinja777
2 years agoSuper User
Hi Tito
Sumxing over ID of the max sales measure will get your required output. I am not sure why combining in one formula will produce the different result from separating out in two measures like below, but separating out in two measure will get your required output.
Sumxing over ID = sumx(values('Table'[ID]),[Max sales])
Best regards,
- Tito2 years agoHelper IV