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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
fyrworx
Frequent Visitor

DATEINPERIOD issues

I am trying to create a rolling 6 week view of a count. 

 

It should be simple - an aggregate of weekly totals for the last 6 weeks of daily data. Put into a line graph.

 

I am following this guide: 

http://www.powerpivotpro.com/2013/07/moving-averages-sums-etc/

 

But running into an error when I try select the number of intervals as below:

Capture.PNG

 

 

 

 

 

 

Any ideas as to why? 

 

I realise it says day in my example. I was testing it on a day to day moving visual before creating the 6 week. I also see that PowerBI does not have a week option, any help in creating that would be appreciated too.

 

1 ACCEPTED SOLUTION

Hi @fyrworx,

 

Please modify your DAX formula as:

3 Month Moving Sum Units Sold =
CALCULATE (
    SUM ( 'Moving Average'[Compliant] ),
    ALL ( 'Moving Average' ),
    DATESINPERIOD ( Dates[Date], LASTDATE ( Dates[Date] ), -3, DAY )
)

Thanks,
Yuliana Gu

Community Support Team _ Yuliana Gu
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

2 REPLIES 2
fyrworx
Frequent Visitor

I seem to have figured out the error but can't get the visual to work the way I want it.

 

Apparently the syntax requires a space after the number of intervals, before the ",".

 

Which doesn't make sense. Anyone else have this issue?

Hi @fyrworx,

 

Please modify your DAX formula as:

3 Month Moving Sum Units Sold =
CALCULATE (
    SUM ( 'Moving Average'[Compliant] ),
    ALL ( 'Moving Average' ),
    DATESINPERIOD ( Dates[Date], LASTDATE ( Dates[Date] ), -3, DAY )
)

Thanks,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.