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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Srikantht
Helper II
Helper II

How to get following(prior) 8 weeks of avg data qty in DAX

Srikantht_0-1650465202457.png

 how to write a measure of average of following(coming) 8 weeks qty for the above data  & I have week end date in calendar . can anyone help for solution? 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Srikantht ,

I created some data:

vyangliumsft_0-1651043158062.png

Here are the steps you can follow:

Create measure.

Measure =
var _today=TODAY()
var _week=WEEKNUM(_today,1)
return
AVERAGEX(FILTER(ALL('Table'),'Table'[week]>=_week-8&&'Table'[week]<_week),[rand])

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi  @Srikantht ,

I created some data:

vyangliumsft_0-1651043158062.png

Here are the steps you can follow:

Create measure.

Measure =
var _today=TODAY()
var _week=WEEKNUM(_today,1)
return
AVERAGEX(FILTER(ALL('Table'),'Table'[week]>=_week-8&&'Table'[week]<_week),[rand])

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Thank you its working

johnt75
Super User
Super User

Assuming that Demand Quantity is a measure, you could try

Avg 8 weeks =
VAR currentEndWeek =
    LOOKUPVALUE ( 'Date'[End of week], 'Date'[Date], TODAY () )
VAR finalEndWeek = currentEndWeek + 56
RETURN
    AVERAGEX (
        ADDCOLUMNS (
            CALCULATETABLE (
                VALUES ( 'Date'[End of week] ),
                'Date'[End of week] >= currentEndWeek
                    && 'Date'[End of week] <= finalEndWeek
            ),
            "@val", [Demand Quantity]
        ),
        [@val]
    )

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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