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
Anonymous
Not applicable

Forward rolling total demand

The values are spread over different attributes such as Production, Demand, ETA etc. I need to find out a 3 month total demand calculated from any selected date. Following are the DAX i tried. But the values are incorrect. How to correct this?

 

roshan_rpr_0-1658837918934.png

 

DAXs used to calculate 3 month total demand:

 

3 months total values =
VAR LastDate_ = LASTDATE(Append1[Week Start date])
RETURN
    CALCULATE(
        SUM(Append1[Value]),  
        DATESINPERIOD(Append1[Week Start date], LastDate_, 3, MONTH)
    )
 
3 months total demand = CALCULATE([3 months total values],FILTER(Append1, Append1[Attributes]="Demand"))

 

1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

Try it.

3 months total values = 
VAR LastDate_ = LASTDATE(Append1[Week Start date])
RETURN
   IF(MAX('Append1'[Attributes])= "Demand",CALCULATE(
        SUM(Append1[Value]),  
        DATESINPERIOD(Append1[Week Start date], LastDate_,- 3, MONTH),Append1[Attributes]="Demand"))

the final show:

vyalanwumsft_0-1659081946094.png


Best Regards,
Community Support Team _ Yalan Wu
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
v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

Try it.

3 months total values = 
VAR LastDate_ = LASTDATE(Append1[Week Start date])
RETURN
   IF(MAX('Append1'[Attributes])= "Demand",CALCULATE(
        SUM(Append1[Value]),  
        DATESINPERIOD(Append1[Week Start date], LastDate_,- 3, MONTH),Append1[Attributes]="Demand"))

the final show:

vyalanwumsft_0-1659081946094.png


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

amitchandak
Super User
Super User

@Anonymous , For all time intelligence functions use date table

 

VAR LastDate_ = LASTDATE(Append1[Week Start date])
RETURN
CALCULATE(
SUM(Append1[Value]),
DATESINPERIOD(Date[date], LastDate_, 3, MONTH)
)

 

 

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-bd52912a5bd4
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

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.