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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
JamesHR
New Member

Calculating Moving Range - skipping first data point

Hi I am trying to calculate the moving range to make an SPC chart using a measure. However with my calculation I am currently using the moving range includes the first value which I never want to include.

 

What I want to know is how do I ingore that value when calculating the moving range. 

 

 

Moving Range = 
VAR EarlierTime =
    CALCULATE (
        MAX ( 'Data sheet'[Date] ),
        FILTER (
            ALLSELECTED('Data sheet'[Date]),
            'Data sheet'[Date] < SELECTEDVALUE ( 'Data sheet'[Date])
        )
    )
VAR EarlierMeasureValue =
    CALCULATE ( SUM ( 'Data sheet'[Value] ), 'Data sheet'[Date] = EarlierTime)
RETURN
ABS ( EarlierMeasureValue - SUM ( 'Data sheet'[Value] ))

 

  

1 REPLY 1
v-stephen-msft
Community Support
Community Support

Hi @JamesHR ,

 

You can create a ranking column for your values and then filter out the first value you don't want in your original measure formula.

Power BI RANKX | How to Use RANKX Function

 

 

Best Regards,

Stephen Tao

 

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

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.