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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
rogerdea
Helper IV
Helper IV

Rolling 12 month issue

I have used DAX to do a rolling 12 month sum, but have a rogue value, which i think is where one of the months has no data value (see image, its month 2021-01).

 

How can i get around this so that it includes the blank in the 12M sum? (column B in the image)  I already tried added IF(ISBLANK to te DAX but it didn't seem to help.

 

rogerdea_0-1667201691575.png

 

My DAX is:

 

R12M Sum =
CALCULATE(
    SUM( Data[Amount] ),
    DATESINPERIOD(DateTable[Date], MAX(Data[DateTime] ), -12,  MONTH )
)
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@rogerdea , Make sure to join with Data and Date table in 1-M single direction, The date in the data table should not have a timestamp other than 12 AM

 

You should date from date table in visual

 

explained the reasons here Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI:https://youtu.be/OBf0rjpp5Hw
https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5b...

Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],MAX('Date'[Date]),-12,MONTH))

 

Rolling Months Formula: https://youtu.be/GS5O4G81fww

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
rogerdea
Helper IV
Helper IV

Thanks very much there were two things i needed to do to fix the DAX.

1)  Mark date table as the date table.

2) Change the second date in my DAX to be the date field from the date table, NOT my fact table.

amitchandak
Super User
Super User

@rogerdea , Make sure to join with Data and Date table in 1-M single direction, The date in the data table should not have a timestamp other than 12 AM

 

You should date from date table in visual

 

explained the reasons here Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI:https://youtu.be/OBf0rjpp5Hw
https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5b...

Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],MAX('Date'[Date]),-12,MONTH))

 

Rolling Months Formula: https://youtu.be/GS5O4G81fww

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.