Forum Discussion
Total Sum by Product Difficulty
- 2 years ago
So to give you a potential explanation of what the measure do i'll tell you the following:
the average of 10+12 = 22 meaning average is 22/2 = 11
This is what happens when you use the measure
AVERAGE(Warehouse_and_Retail_Sales[RETAIL SALES])The column is the only variable used in the calculation. When creating a visual the calculation is partinioned by the product group as seen in scenario 3.With the other measure you do the following:you calculate the Sum of sales which for example REF = 380.You then divide 380 by the number of times it shows up. However in this case only 380 is known so it does: 380/1 = 380. meaning the average shown is 380.The method i mentioned earlier does 10+ 12 = 22 / 2 = 12 Average.Something similar is happening with SUMX()What we usually do in SQL and DAX is calculate over a column: RETAIL_SALES and then partition it over a group. in SQL we do GROUP BY and in Power BI this is done automatically by selecting different components in a visualKR,--Troekoe
Yo!
The issue is that in your DAX query:
The second staement in the FILTER() function should be an expression. For isntance
Measure = AVERAGE(Your_table[Sales])
Thanks so much for your clear explanations. So I've included the summary data and I'm getting three different results: I'll show the 3 different measures, including the average measure you've just shown me.
| ITEM TYPE | Sales Amount by Item Type |
| WINE | €746,498.59 |
| BEER | €574,220.53 |
| LIQUOR | €802,691.43 |
| STR_SUPPLIES | €2,740.88 |
| KEGS | €0 |
| REF | €663.63 |
| DUNNAGE | €0 |
| NON-ALCOHOL | €34,084.31 |
1)
2)
3) As suggested in your response:
Each method shows a different result for average, and for the end total.
I'm really confused.
- Troekoe2 years agoFrequent Visitor
So to give you a potential explanation of what the measure do i'll tell you the following:
the average of 10+12 = 22 meaning average is 22/2 = 11
This is what happens when you use the measure
AVERAGE(Warehouse_and_Retail_Sales[RETAIL SALES])The column is the only variable used in the calculation. When creating a visual the calculation is partinioned by the product group as seen in scenario 3.With the other measure you do the following:you calculate the Sum of sales which for example REF = 380.You then divide 380 by the number of times it shows up. However in this case only 380 is known so it does: 380/1 = 380. meaning the average shown is 380.The method i mentioned earlier does 10+ 12 = 22 / 2 = 12 Average.Something similar is happening with SUMX()What we usually do in SQL and DAX is calculate over a column: RETAIL_SALES and then partition it over a group. in SQL we do GROUP BY and in Power BI this is done automatically by selecting different components in a visualKR,--Troekoe- MandoMongo2 years agoRegular Visitor
Thank you Troekoe, much appreciated explanations