Forum Discussion
SUMX Over Distinct and Max
- 5 years ago
Thanks for the replies but unfortunately they were not working for me.
I have managed to solve it using the following measure:Channels Total = SUMX( VALUES ( Charges[CLI] ), CALCULATE ( CALCULATE ( MAX ( Charges[Channels] ), FILTER ( VALUES ( Charges[BillingPeriod] ), Charges[BillingPeriod] = MAX ( Charges[BillingPeriod] ) ) ) ) )I have updated the sample project to reflect this:
https://1drv.ms/u/s!AoTVsSI4n62qjZ0Mq4u-5-4lAzqDqw?e=mYde5a
If anyone know a more efficient way to right this then I would love to hear.
Also I'm not sure why I had to use CALCULATE twice but it was the only way I could include part of the code without having to create a seperate measure.
If anyone has a good explanation for this then please let me know.
gclements , Create a measure like
sumx(summarize(Table, Table[CLI], Table[Channels]), [Channels])
or
sumx(values(Table[CLI]), calculate(Max (Table[Channels])))
This doesnt filter on the MAX(Billing Period) so will give the wrong result, such as 07700000013 the most recent channels is 20, not 30 but MAX(Channels) will result in 30. It needs to be the channels associated with the MAX(Billing Period).