Forum Discussion
MandoMongo
2 years agoRegular Visitor
Total Sum by Product Difficulty
* EDIT: I think I have it but perhaps not working as it should Average Sale by Item Type = AVERAGEX( VALUES(Warehouse_and_Retail_Sales[ITEM TYPE]), [Total Retail Sales] ) Total Sale b...
- 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
Troekoe
2 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 visual
KR,
--Troekoe
MandoMongo
2 years agoRegular Visitor
Thank you Troekoe, much appreciated explanations