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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It 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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

April Fabric Community Update

Fabric Community Update - April 2024

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