Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
bvanderwatt
Helper III
Helper III

Average Sales (excluding "empty" months)

Good Day

 

PowerBi Link: https://drive.google.com/drive/folders/1l0H90UpW0LLzvOEnntJBa9eD2Kfimvss?usp=sharing

 

My measure works perfectly for combined branches of average units. 

 

However, when I split it by branch, the inidvidual branch average units doesn't equal the total ave units. I think this is due some months having no sales for some months. 

 

Ave units all branches: 871 

Ave Units: Asia (214) + Canada (315) + Europe (139) + South Africa (257) = 925 units

 

bvanderwatt_0-1660741426506.png

Below is my measure: 

Ave Qty Sold (Last 12 months) =
    averagex(
        summarize(
            calculatetable(
            'Calendar',
                Datesbetween(
                    'Calendar'[Date],
                        edate(eomonth(today(),-1)+1,-12),
                        eomonth(today(),-1))),'calendar'[Year],
                        'Calendar'[Month],
                        "ABCD",
                        [Inv+Order (Qty)]),
                        [ABCD]
        )

@Ashish_Mathur 

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Averages are never additive.  To get a grand average, one cannot add individual averages.  Therefore the results in your post might be correct.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

@bvanderwatt , Assume you have measure unit ,

 

Then try measure like

 

averageX(Values(Date[YYYY-MMM]) , [Unit])

 

 

if you want to do it on a column

 

averageX(Values(Date[YYYY-MMM]) ,calculate(sum(Table [Unit])) )

 

This will sum till month level and Avg above it

Thank you so much. I need to use completed months. Therfore, I need to exclude August which is the current month. 

 

Please see below my formula. Hoping this will be a quick fix 🙂 

 

Ave Qty Sold (Last 12 months) =
    averagex(
        summarize(
            calculatetable(
            'Calendar',
                Datesbetween(
                    'Calendar'[Date],
                        edate(eomonth(today(),-1)+1,-12),
                        eomonth(today(),-1))),'calendar'[Year],
                        'Calendar'[Month],
                        "ABCD",
                        [Inv+Order (Qty)]),
                        [ABCD]
        )

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.