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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.