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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
tomgag
Resolver I
Resolver I

Average and Moving average

Hi All, I need help with some basic stuff. I fried my brain and hit the dead end.

 

So, how can I add simple average for the whole period and 3 weeks MA to my data to get the below in bold columns?

 

WeekScheduleUnscheduleAve ScheduleAve UnscheduleMA 3 Weeks (Schedule)MA 3 Weeks (Unschedule)
1100100125124  
2110110125124  
3120120125124  
4130130125124330330
5140140125124360360
660100125124390390
7160110125124330370
8170120125124360350
9180130125124390330
1080180125124510360
11    430430
1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @tomgag

Based on my test, the "Ave Schedule" and "Ave Unschedule" provided by Greg_Deckler are right.

Then, Try the following formula to get calculated columns "3 weeks MA"

2.png

MA 3 Weeks (Schedule) =
IF (
    [Week] > 3,
    SUMX (
        FILTER (
            ALL ( 'Table' ),
            [Week] < EARLIER ( [Week] )
                && [Week]
                    >= EARLIER ( [Week] ) - 3
        ),
        [Schedule]
    )
)

MA 3 Weeks (Schedule) =
IF (
    [Week] > 3,
    SUMX (
        FILTER (
            ALL ( 'Table' ),
            [Week] < EARLIER ( [Week] )
                && [Week]
                    >= EARLIER ( [Week] ) - 3
        ),
        [Unschedule]
    )
)

Best Regards

Maggie

View solution in original post

2 REPLIES 2
v-juanli-msft
Community Support
Community Support

Hi @tomgag

Based on my test, the "Ave Schedule" and "Ave Unschedule" provided by Greg_Deckler are right.

Then, Try the following formula to get calculated columns "3 weeks MA"

2.png

MA 3 Weeks (Schedule) =
IF (
    [Week] > 3,
    SUMX (
        FILTER (
            ALL ( 'Table' ),
            [Week] < EARLIER ( [Week] )
                && [Week]
                    >= EARLIER ( [Week] ) - 3
        ),
        [Schedule]
    )
)

MA 3 Weeks (Schedule) =
IF (
    [Week] > 3,
    SUMX (
        FILTER (
            ALL ( 'Table' ),
            [Week] < EARLIER ( [Week] )
                && [Week]
                    >= EARLIER ( [Week] ) - 3
        ),
        [Unschedule]
    )
)

Best Regards

Maggie

Greg_Deckler
Super User
Super User

The first two are easy:

 

Column Ave Schedule = AVERAGEX(ALL('Table'),[Schedule])
Column Ave Unschedule = AVERAGEX(ALL('Table'),[Unschedule])

The second two I don't understand because those look like sum's and not averages but probably something like:

 

Column MA 3 Weeks (Schedule) =
SUMX(FILTER(ALL('Table'),[Week]<EARLIER([Week])&&[Week]>=EARLIER([Week])-2),[Schedule])

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.