Forum Discussion
Calculate the average per category
- 6 years ago
Which calculations you have used.
In case you have used this, hope you created it is a measure, not Column
divide(sum(price),sum(qty))Please share the formula you created. It should be dynamic. Unless there is join missing. Or Interactions are off.
Try like
divide(sum(price),sum(qty))
This will adjust according to the group by.
In case you need a category level fixed. try
https://community.powerbi.com/t5/Desktop/Calculate-Average-per-category/td-p/362637
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
https://community.powerbi.com/t5/Community-Blog/Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners/ba-p/890814
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970
https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p/881739
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601
Thanks for you answer.
Using the solution mentioned in the provided link i get the correct calculation. The problem now is that the calculation seems to be static.
I have data from several months. If i select now a single month in my report the calculation does not adjust.
Is it possible to create a dynamic calculation?
- amitchandak6 years ago
Super User
Which calculations you have used.
In case you have used this, hope you created it is a measure, not Column
divide(sum(price),sum(qty))Please share the formula you created. It should be dynamic. Unless there is join missing. Or Interactions are off.
- Anonymous6 years agoNot applicable
Thank you!
Using a measure instead of a column was the solution.
Like I said ... the answer was very simple.
I think i need to go back an review the differences between measures and columns.
Thanks again for the responses!
- amitchandak6 years ago
Super User
Columns are pre-calculated. You can see them in the table view. And the measure is calculated run time. means there will impact of data grouping.
For Multiple-use, We typically use column A*B and then SUM. This means we need a column. Sales Amount= QTY* Price and then Sum(Sales Amount)
For Divide, we need to do Sum(A)/Sum(B). Discount % = Sum(Discount)/Sum(Sales)*100. Means we need measure.
Refer the pbix on this article - https://community.powerbi.com/t5/Community-Blog/Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners/ba-p/890814