Forum Discussion
Using total to calculate a different measure
Hi Everyone, I have a problem to which I can't find a result. Basically I am trying to use an absolute total (not affected by any filters that might prop up) over a data-set in a different measure:
| Shop | Town | Day | Bikes Sold |
| A | 1 | 07/02/2016 | 2 |
| A | 1 | 08/02/2016 | 4 |
| B | 1 | 07/02/2016 | 6 |
| B | 1 | 08/02/2016 | 3 |
| C | 2 | 07/02/2016 | 7 |
| C | 2 | 08/02/2016 | 1 |
| Result | |||
| Shop | Town | Average Bikes Sold Per Day | Score |
| A | 1 | 3 | 0.8 |
| B | 1 | 4.5 | 1.2 |
| C | 2 | 4 | 1.0 |
| Total | 3.83 |
My problem is that if I use a report Filter/Slicer to filter down to town level for example, it automatically recalculates the total average and changes the score. I want to be able to slice by town*, but the total to stay the same. What I am basically using now is SUM(BikesSold)/DistinctCount(Shop). To fix the total part I have tried a blank 'Allselected() or Allexcept(town) (-this one takes the max amount of distinct counts over the time period) but it bugs out in a way or the other.
Thanks!
Hi DanielB,
I try to reproduce your scenario get the expected result, please see the following solution.
Create a measure using the following formula.Average Bikes Sold Per Day = AVERAGEX(SUMMARIZE('Table','Table'[Shop],'Table'[Town],"Aa",AVERAGE('Table'[Bikes Sold])),AVERAGE('Table'[Bikes Sold]))For example, create table used to diplay the shop, town and Average Bikes Sold Per Day values. Create a slicer including town values, when you click 1, it will the corresponding values, and the total average changes automatically.
If you have any other problem, please let me know.
Best Regards,
Angelia
2 Replies
- LaurentCouartou
Solution Supplier
Have you tried with ALL()?
- v-huizhn-msft
Microsoft Employee
Hi DanielB,
I try to reproduce your scenario get the expected result, please see the following solution.
Create a measure using the following formula.Average Bikes Sold Per Day = AVERAGEX(SUMMARIZE('Table','Table'[Shop],'Table'[Town],"Aa",AVERAGE('Table'[Bikes Sold])),AVERAGE('Table'[Bikes Sold]))For example, create table used to diplay the shop, town and Average Bikes Sold Per Day values. Create a slicer including town values, when you click 1, it will the corresponding values, and the total average changes automatically.
If you have any other problem, please let me know.
Best Regards,
Angelia