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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
pbiuser1122
Frequent Visitor

How to ignore first value shown in line graph when using a moving range measure

Hi, I've encountered an issue when populating a line graph with a moving range calculation. 

 

The screenshot below shows the graphs that I have.
- The first graph simply shows mean values over time.
- The second graph shows the absolute value of the difference between mean values over time using a Moving Range Measure, I interested the DAX calculation for that below. I am looking for a way to modifiy my DAX calculation for moving range in order to ignore the first data point. I have to calculate the average of the moving range and this first data point is throwing that off. I highlighted in red which data point I am referring to. I also have a date slicer hooked up to my visuals so users can adjust the timeframe, so I need a solution that can cater to that need. 

pbiuser1122_0-1705523614126.png

Here is my DAX calculation for moving range:

pbiuser1122_0-1705524101912.png

 

I appreciate any help regarding this issue. 

11 REPLIES 11
pbiuser1122
Frequent Visitor

Hi @v-yilong-msft , thank you for your response.

I tested out your solution, but ran into an issue. I believe this issue occured since my Moving Range field is a measure and not a column or calculated column. 

pbiuser1122_0-1705597886085.png
I slightly modified the DAX measure you provided:

pbiuser1122_1-1705597956392.png

I tested out this measure and it seems that it is removing that first data point, but it outputting the Sum of Mean Value instead of the Moving Range. 

pbiuser1122_2-1705598031859.png

 

For some additional context, there are filters implemented on the table visual for various fields. One of those filters is on the Created On field to only show a select about of data. Here is what the Created On, Sum of Mean Value, and Moving Range fields look like in a table without any filters:

pbiuser1122_4-1705598497422.png

So, I'm looking for a solution where the first Moving Range value will not be visible no matter what filters are selected. 

pls try this

 

Measure =  
CALCULATE([Moving Range], 
OFFSET(1,SUMMARIZE(ALLSELECTED('Table'),'Table'[Created On]),
ORDERBY('Table'[Created On])))

 

Hi @Ahmedx , thank you for your reply.

I tried your suggested measure. It did not seem to work. When I added this measure to the line graph visual, it seems to be calculating the Sum of Mean Value rather than Moving Range.
Here is the line graph with your suggested Measure:

pbiuser1122_0-1705679226289.png

Which is the same as my Sum of Mean Value line graph:

pbiuser1122_1-1705679329095.png


I tried modifying my Moving Range Measure to incorporate your suggested Measure:

pbiuser1122_2-1705679382486.png

But this did not work, it is still showing that first value:

pbiuser1122_3-1705679440930.png

 



you don’t need to put everything in one measure
need to be written separately as two measures

When I try your measure as a separate measure, it does not give the desired output:

pbiuser1122_0-1705692930880.png

The Moving Range line is what my desired output is but with the first value being ignored. 
Your suggested Measure is returning the Sum of Mean Value that the Moving Range Measure is built off of. 

pls try this

if this doesn't help then share the file

 

Moving Range =
VAR _MinDate =
    MINX ( ALLSELECTED ( 'Data' ), 'Data'[Created On] )
VAR EarlierTime =
    CALCULATE (
        MAX ( 'Data'[Created On] ),
        FILTER (
            ALLSELECTED ( 'Data'[Created On] ),
            'Data'[Created On] < SELECTEDVALUE ( 'Data'[Created On] )
                && 'Data'[Created On] > _MinDate
        )
    )
VAR EarlierMeasureValue =
    CALCULATE ( [Sum of Mean Value], 'Data'[Created On] = EarlierTime )
VAR Moving_Range =
    ABS ( EarlierMeasureValue - [Sum of Mean Value] )
RETURN
    Moving_Range

 

I created an example file but do not see an option to attach a pbix file.

upload to onedrive or another

@Ahmedx Sorry for delayed response, I had to check my companies policies. Unfortunately I cannot share the exact file due to confidentality. However, I created an example file where I pulled a snippet of data from the original file and recreated the issue I am running into. The original file has far more data. 

 

Here is the a link to download the example file: Example File 

v-yilong-msft
Community Support
Community Support

Hi, @pbiuser1122 

Based on the information you have provided, Here are my answers to your questions.

1. Based on the image you provided, firstly I created a table.

vyilongmsft_0-1705566784110.png

 

2. Create a Measure, enter the appropriate DAX code, and remove the date furthest back so that it meets your needs.

 

Measure = 
  VAR _a = MINX(ALLSELECTED('Table'),'Table'[Created On])
  VAR _b = MAX('Table'[Created On])
RETURN
  IF(_b = _a,BLANK(),MAX('Table'[Moving Range]))

 

vyilongmsft_0-1705567057638.png

 

 

 

How to Get Your Question Answered Quickly 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Yilong Zhou

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

Hi @v-yilong-msft , thank you for your response.

I tested out your solution, but ran into an issue. I believe this issue occured since my Moving Range field is a measure and not a column or calculated column. 

pbiuser1122_0-1705597886085.png
I slightly modified the DAX measure you provided:

pbiuser1122_1-1705597956392.png

I tested out this measure and it seems that it is removing that first data point, but it outputting the Sum of Mean Value instead of the Moving Range. 

pbiuser1122_2-1705598031859.png

 

For some additional context, there are filters implemented on the table visual for various fields. One of those filters is on the Created On field to only show a select about of data. Here is what the Created On, Sum of Mean Value, and Moving Range fields look like in a table without any filters:

pbiuser1122_4-1705598497422.png

So, I'm looking for a solution where the first Moving Range value will not be visible no matter what filters are selected. 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.