Forum Discussion
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.
Here is my DAX calculation for moving range:
I appreciate any help regarding this issue.
11 Replies
- AnonymousNot applicable
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.
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]))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.
- pbiuser1122Frequent Visitor
Hi Anonymous , 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.
I slightly modified the DAX measure you provided: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.
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:
So, I'm looking for a solution where the first Moving Range value will not be visible no matter what filters are selected.
- pbiuser1122Frequent Visitor
Hi Anonymous , 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.
I slightly modified the DAX measure you provided: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.
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:
So, I'm looking for a solution where the first Moving Range value will not be visible no matter what filters are selected.
- Ahmedx
Super User
pls try this
Measure = CALCULATE([Moving Range], OFFSET(1,SUMMARIZE(ALLSELECTED('Table'),'Table'[Created On]), ORDERBY('Table'[Created On])))- pbiuser1122Frequent Visitor
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:Which is the same as my Sum of Mean Value line graph:
I tried modifying my Moving Range Measure to incorporate your suggested Measure:But this did not work, it is still showing that first value: