Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have two slicers. Year and Week of year. I would now like to calculate a total average of stock value for the selected period.
I have two tables.
1. Calendar table with individual dates, week of year and year.
2. Table with stock values per item and per week. The date is first day of the week and connected to the calendar table.
My idea is that first in the background the total for each week is calculated and then divided by the number of weeks. How can I achieve that?
Thanks!
Solved! Go to Solution.
Yes, I did´t considered this case so far...difficult ro cover your need without knowing your datamodel.
Easy to solve.
Divide 2 measures.
AVG = SUM(your_table[Amount Item]) / DISTINCTCOUNT(your_table[WeekNumber])
Try this approach.
Hope you can adjust the idea to your model
you are welcome.
Simple things are best things 🙂
Yes, I did´t considered this case so far...difficult ro cover your need without knowing your datamodel.
Easy to solve.
Divide 2 measures.
AVG = SUM(your_table[Amount Item]) / DISTINCTCOUNT(your_table[WeekNumber])
Try this approach.
Hope you can adjust the idea to your model
Way simpler than I thought. Thank you so much for your help and pacience! That worked just fine!
Ok, then check your datamodel. Something seems not correct.
My small model works fine with filter on item.
K22:
M55:
In the first screen the total is 83 for 26 weeks. So, shouldn´t it be 83/26 = 3.19? That would be the sum of the two. But yours shows 1.6. Which would be the average of the 2.0 and 1.2.
Hey @Basti76 ,
pls show me what you mean by "But if I leave it open with all the outcome is incorrect".
Which other additional filter do you use?
Sorry for the unclear explanation. If I would add a filter and only look at the average for one item I get the same result. If I don´t filter on item level (using a slicer) I don´t get the correct result.
this is what I get by using
AVG Item = AVERAGE(yout_table[Value_Item])
------------------------------------
Slicer works fine...
Really much appreciate your help. 🙂 When I add another filter and look at this for just one item it works fine. But if I leave it open with all the outcome is incorrect. 🤔
I tried explaining it below the second point. I know it always make sense in my head but not for the rest. 🙂
This is what I get with the average formula. The correct value should be 31M divided by 26 weeks (around 1.2M).
Yes, I thought it was the target to calculate average over stock item. No?
What is your expected target value/visualization?
Maybe a Screenshot for that?
Thanks @sergej_og
The issue with this solution is that I think I get an average stock value per item.
You can try to use the AVERAGE funktion.
Stock AVG = AVERAGE(yout_table[stock value]).
Put this measure on table visual and try to check the result by using your Calendar Table.
Makes sense?
Hope I catched your idea right
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
68 | |
64 | |
51 | |
39 | |
26 |
User | Count |
---|---|
84 | |
57 | |
45 | |
44 | |
35 |