Forum Discussion
Pillic
Helper II
4 years agoADD calculated Average to each row
Hello comunity,
I have a simple table that looks like this:
delivery | product | price | r price
| 1011084259 | 10096246 | 37 | 50,7 |
| 1011085643 | 10096246 | 37 | 44,1 |
| 1011260543 | 10096246 | 37 | 55,2 |
| 1011369349 | 10096246 | 37 | 42 |
| 1011684236 | 10089222 | 25 | 63,7 |
| 1011675242 | 10096246 | 37 | 46,9 |
| 1011677098 | 10096246 | 37 | 48,2 |
| 1011723460 | 10096246 | 37 | 45,2 |
The average of column price is 35,5 = average(table[price])
Now I want to sum the average of price to each row of r price
delivery | product | price | r price | r price + average price
It would be great if this could be solved.
| 1011084259 | 10096246 | 37 | 50,7 | 86,2 |
| 1011085643 | 10096246 | 37 | 44,1 | 79,6 |
| 1011260543 | 10096246 | 37 | 55,2 | 90,7 |
| 1011369349 | 10096246 | 37 | 42 | 77,5 |
| 1011684236 | 10089222 | 25 | 63,7 | 99,2 |
| 1011675242 | 10096246 | 37 | 46,9 | 82,4 |
| 1011677098 | 10096246 | 37 | 48,2 | 83,7 |
| 1011723460 | 10096246 | 37 | 45,2 | 80,7 |
The following measure doesnt work...it sums each price to r price per row.
VAR x = average(table[price])
RETURN CALCULATE(SUM (table[r price]) + x)
It would be great if this could be solved.
Thanks in Advance
Hey,
Try this:
r price + average = VAR r_price = SUM ( 'table'[r price] ) VAR r_price_average = CALCULATE ( AVERAGE ( 'table'[r price] ), ALLSELECTED () ) RETURN r_price + r_price_average
4 Replies
- Barthel
Solution Sage
Hey,
Try this:
r price + average = VAR r_price = SUM ( 'table'[r price] ) VAR r_price_average = CALCULATE ( AVERAGE ( 'table'[r price] ), ALLSELECTED () ) RETURN r_price + r_price_average- Pillic
Helper II
Hello Barthel,
amazing that did the job. I needed to change it a bit like this:
r price + average = VAR r_price = SUM ( 'table'[r price] ) VAR price_average = CALCULATE ( AVERAGE ( 'table'[price] ), ALLSELECTED () ) RETURN r_price + r_price_averageThanks a ton for this fast response...Yall have a nice weekend, as I will now.