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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
_Regina
Helper I
Helper I

Adding upper and lower Limt lines in a line chart based on Average value +/- 1 standard deviation

Hi all,

 

So I am trying to create something like a process control chart. I have been able to do this , but my upper and lower limit lines work fine when x axis is month, but when I drill to Day level, it does not work as expected. I want it to behave as the buil in avg line behaves. so when I am at month level, the avg line shows month's average but when I am at day level it gives daily average.

 

I understand it is happening because if the way I have built measures- which is as following-

 

_Upper Limit Signups =
[_Avg line Signups]+(1*[_Sd line Signups])
 
_Avg line Signups = AVERAGEX(
                ADDCOLUMNS(
                    SUMMARIZE(
                        ALLSELECTED('Calendar'[Month]),'Calendar'[Month]),
                "@qty",CALCULATE([Count of Onboarding Requests])),
            [@qty])
 
 
_Sd line Signups = STDEVX.P(
                ADDCOLUMNS(
                    SUMMARIZE(
                        ALLSELECTED('Calendar'[Month]),'Calendar'[Month]),
                "@qty",CALCULATE([Count of Onboarding Requests])),
            [@qty])
 
 
And the I am using '_Upper Limit Signups' in Y axis constant line under analytics pane.

_Regina_0-1713903011672.png

_Regina_1-1713903921849.png

I do understand, that because I am summarizing by month, it is behaving like this but how do I modify it to behave as expected for month/day or whatever calendar hierarchy is there.

 

Thank you in advance

 

2 REPLIES 2
_Regina
Helper I
Helper I

@v-jianpeng-msft Thank you. but I cannot train my users to do that. 

I want to achieve the same functionality as the built in average line.

_Regina_2-1714164767346.png

 

ex 

_Regina_1-1714164740073.png

 

_Regina_0-1714164703899.png

The average value recalculates. I want to achieve similar results for upper control line and lower control line. Any help/guidance is appreciated.

 

v-jianpeng-msft
Community Support
Community Support

Hi, @_Regina 

Based on your description, I tried it using the following chart:

vjianpengmsft_0-1713943436034.png

Here's my DAX expression:

_Avg line Signups = 
AVERAGEX(
    ADDCOLUMNS(
        SUMMARIZE(ALLSELECTED('Calender'),'Calender'[Date]),
        "avg",[Sum of price]
    ),
    [avg])

When I use the arrow in the top right corner to get to the next level, the constant line doesn't change:

vjianpengmsft_2-1713943517593.png
vjianpengmsft_1-1713943503420.png

vjianpengmsft_3-1713943555888.png

When I use the drill down function of the right-click menu, it is recalculated:

vjianpengmsft_4-1713943640551.png

vjianpengmsft_5-1713943699841.png

To make it easier to explain the problem with this constant line, I've tried to create a table visual:

This is my data:

vjianpengmsft_7-1713944008011.png

In the diagram below, we find that _Avg line Signups is always 3, which is calculated as 15/5=3. The dependency is on the total of sales rather than the context of the hierarchy currently entered by the arrows.

vjianpengmsft_6-1713943974414.png

So that's why when you go to the level of date through the arrow in the top right corner, your constant line doesn't do a recalculation. You can proceed to the next level by right-clicking on the drill down function, and your constant line will be recalculated.

I provide the PBIX file used this time below.

 

 

 

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

Jianpeng Li

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors