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.
Hi all!!
I have data that contains quantity ordered and has the dates assosicated with the orders, what I want to calculate is an average of the quantity ordered calculated by number of months. For eg: for the time period june 2019-june 2020 the calculation would be =total number of orders/13 (number of months)
I am doing this to be able to plot an avg line in a line and column chart that shows the quanity ordered by months:
The avg should be indicated by the dark blue line but clearly it is wrong. Also, how can I remove the previous months that have no orders for this particular location, every location has different data...
I also thought of calculating the number of months from the first month ordered till current month, but I'm struggling to do that as well..
Sorry if this is too complicated but any help would be greatly appreciated!!! I'm relatively new to power BI and I've been struggling with this report for the past few days.
Thank you 🙂
Hi @nidhijo ,
Depend on you chart, I create some data.
AVARAGE Quantity =
VAR _total =
SUMX( ALL( 'Table' ), [Orders] )
// If you have condition to calculate the number of quantity order, you can use SUMX(FILTER(ALL('Table'),conditions),[Orders])
VAR _numOfmonth =
COUNTROWS(
FILTER(
SUMMARIZE( ALL( 'Table' ), 'Table'[Date], "sum", SUM( 'Table'[Orders] ) ),
[sum] > 0
)
)
RETURN
_total / _numOfmonth
// If you do not want to display the blank months , try following
// IF(ISBLANK([Quantity orders]),BLANK(),_total/_numOfmonth)
The result:
OR
I put my pbix file in the attachment and you can refer, if I misunderstood you, please let me know.
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I can't use the analytics pane as it is only for the line visual, if I convert this to line visual it does not show me the distrubution for each month which I would like to see. Thanks for the link I'll check out your blog. Also, do you know how I could remove the previous months with no data from my visual? @Greg_Deckler
@nidhijo To remove the previous months with no data, you need your measures that are returning data in those months to return BLANK instead.
@nidhijo Can't you just use the Analytics pane's Average feature? Otherwise it is a measure aggregation problem. This looks like a measure aggregation problem. See my blog article about that here: https://community.powerbi.com/t5/Community-Blog/Design-Pattern-Groups-and-Super-Groups/ba-p/138149
The pattern is:
MinScoreMeasure = MINX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
MaxScoreMeasure = MAXX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
AvgScoreMeasure = AVERAGEX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
etc.
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 |
---|---|
21 | |
7 | |
6 | |
5 | |
5 |
User | Count |
---|---|
27 | |
10 | |
10 | |
9 | |
6 |