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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
zenton
Helper II
Helper II

Cumulative Rolling Average with multiple values on same date

Hi,

I am having issues with rolling average measure.

The 3 values highlighted should be 179.59, 181.83 & 183.05 but they all calculate to 183.05.

 

Mean =
CALCULATE (
AVERAGE ( 'Labware'[Value] ),
DATESBETWEEN ( Labware[Calendar Date], [Historical Date], [First Sample Date] ),
ALL ( Labware[LIMS Text ID] )
)

 

Historical Date equals start date from looklup (29/11/2006) in this example)

First Sample Date =
CALCULATE ( MIN ( Labware[Calendar Date] ), ALLSELECTED ( '2DateTable'[Date] ) )

 

zenton_1-1730326006896.png

 

Thanks Rodney

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @zenton ,

 

Based on your description I created simple data:

vlinhuizhmsft_0-1730341402702.png

 

You can try creating an index column:

vlinhuizhmsft_1-1730341569629.png

 

Try the following DAX:

Mean = 
VAR _historyindex=MINX(ALL('Labware'),'Labware'[Index])
VAR _firstindex=MAX('Labware'[Index])
RETURN
CALCULATE(AVERAGE('Labware'[Value]),FILTER(ALL('Labware'),'Labware'[Index]>=_historyindex&&'Labware'[Index]<=_firstindex))

 

Result:

vlinhuizhmsft_2-1730341652658.png

Best Regards,
Zhu

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @zenton ,

 

Based on your description I created simple data:

vlinhuizhmsft_0-1730341402702.png

 

You can try creating an index column:

vlinhuizhmsft_1-1730341569629.png

 

Try the following DAX:

Mean = 
VAR _historyindex=MINX(ALL('Labware'),'Labware'[Index])
VAR _firstindex=MAX('Labware'[Index])
RETURN
CALCULATE(AVERAGE('Labware'[Value]),FILTER(ALL('Labware'),'Labware'[Index]>=_historyindex&&'Labware'[Index]<=_firstindex))

 

Result:

vlinhuizhmsft_2-1730341652658.png

Best Regards,
Zhu

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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