At the lowest level it’s doing what i’d like, but at the total customer level it’s not. At a customer level it’s not taking the total value of the credits and dividing it by the total tonnes (the reason for some zero quantities is quality credits, so no qty returned, the credits only effect the price).
Any ideas how i can get around this? Do i need to base my measures on a single context or should i be able to apply them to multiple contexts?
Thanks,
Bronwyn
You’ve correctly diagnosed the problem as one of insufficient context at the total line. Here’s one way to handle it (note that I’ve guessed at some of your table names so you may need to tweak this a bit to get it to work in your report). The logic applied (using IF(HASONEVALUE()) is if there is a single customer description, use your AVERAGEX measure as is, if not (i.e., the total line), then divide SUMX of net revenue by SUMX of total tonnes.
Hi @bgood, we’ve noticed that no response has been received from you since 26th February 2020. We just want to check if you still need further help with this post? In case there won’t be any activity on it in the next few days, we’ll be tagging this post as Solved. If you have a follow question or concern related to this topic, please remove the Solution tag first by clicking the three dots beside Reply and then untick the checkbox. Thanks!
Just helping you to understand solution given by @BrianJ.
It all depends on context. Previously, you were trying to use ‘Customer’[CustomerDescription] column and Brian’s formula would work on that. Now, you are using DocumentNo column in your table. You will have to update below code if you want to use other column to get average.
@hafizsultan thank you. My apologies, the screenshot i took was not quite like for like. My comment stands, as even at the Customer Description context, the total of all credits & invoices is not being calculated correctly. Price/t being Brian’s formula.