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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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