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
jdat011
New Member

Lastnonblank and average on rolling sum

Hi all,

 

I posted some minutes ago, but my post is not showing up so it might be ended in the spam 😞

Im trying to create a measure based on planning stock data. I already created a last non blank one for the qtyPlanned. But I need another one which is a rolling average over the last 3 PlanDates. The average needs to include blank values, so it might be better to have a rolling sum of the last non empties and then divide by 3 days.

 

 

ProductSnapshotdatePlanDateQtyPlannedLastNonEmpty
A2022-11-012022-11-3050x
A2022-11-052022-12-01150 
A2022-11-072022-12-01170x
A2022-11-072022-12-0220x
A2022-11-082022-12-0330 

 

The lastNonEmpty column is just to show which rows I need, the column shouldnt be needed in the dataset.

The result should look like this:

 

ProductLastPlanValueAveragePlanValue
A3080

 

The average value should work, even wheren there is no filter set on PlanDate.

I already had a lot of research and I made it to create a very complicated measure which is working as long as I have the PlanDate in the report, but the value is always empty when I remove the PlanDate as a grouping or filter.

 

Thanks for reading, any help is appreciated !

1 REPLY 1
amitchandak
Super User
Super User

@jdat011 ,

 

Lastnonblank(Table[PlanDate], Sum(Table[QtyPlanned])

 

Average(Table[QtyPlanned]) 

 

or

calculate(Average(Table[QtyPlanned])  allselected())

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.