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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
DotsAndSpots
New Member

Dynamic formatting of line chart points in spc chart

Hello,

 

I am attempting to construct an SPC chart in Power BI which charts Activity, Average Activity, Upper Limit (+3 stddev) and Lower limit (- 3 std dev) over time (months). For any given month, if the activity is above the upper or below the lower limit, that point on the graph needs to be a different colour. This all needs to be dynamic as the data is selected via a slicer. My issue is therefore comparing the measures (limits) with actual row values. Can anyone advise on how to achieve this ?

 

Many thanks

1 ACCEPTED SOLUTION
ichavarria
Solution Specialist
Solution Specialist

To compare the activity measure with the upper and lower limits, you can create two additional measures in your dataset for the upper and lower limits using the following DAX expressions:

 

Upper Limit = AVERAGE(Activity) + 3 * STDEV.P(Activity)

 

Lower Limit = AVERAGE(Activity) - 3 * STDEV.P(Activity)

 

Then, you can create a line chart visual in Power BI with months on the x-axis and activity on the y-axis. Add the Average Activity measure as a line series on the chart, and add Upper Limit and Lower Limit as additional line series.

 

To highlight the points above the upper limit or below the lower limit, you can use conditional formatting. Click on the visual and go to the "Visualizations" pane. Under "Data colors," select "Background color" and choose "Advanced controls." Use the following expression to define the color for the data points above the upper limit:

 

= IF([Activity] > [Upper Limit], "Red", "White")

 

Use a similar expression to define the color for data points below the lower limit:

 

= IF([Activity] < [Lower Limit], "Red", "White")

 

This will highlight any data points above or below the limits in red, while leaving the rest of the points white.

 

Best regards, 

Isaac Chavarria 


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

View solution in original post

3 REPLIES 3
ichavarria
Solution Specialist
Solution Specialist

Great to hear my solution worked for you!

ichavarria
Solution Specialist
Solution Specialist

To compare the activity measure with the upper and lower limits, you can create two additional measures in your dataset for the upper and lower limits using the following DAX expressions:

 

Upper Limit = AVERAGE(Activity) + 3 * STDEV.P(Activity)

 

Lower Limit = AVERAGE(Activity) - 3 * STDEV.P(Activity)

 

Then, you can create a line chart visual in Power BI with months on the x-axis and activity on the y-axis. Add the Average Activity measure as a line series on the chart, and add Upper Limit and Lower Limit as additional line series.

 

To highlight the points above the upper limit or below the lower limit, you can use conditional formatting. Click on the visual and go to the "Visualizations" pane. Under "Data colors," select "Background color" and choose "Advanced controls." Use the following expression to define the color for the data points above the upper limit:

 

= IF([Activity] > [Upper Limit], "Red", "White")

 

Use a similar expression to define the color for data points below the lower limit:

 

= IF([Activity] < [Lower Limit], "Red", "White")

 

This will highlight any data points above or below the limits in red, while leaving the rest of the points white.

 

Best regards, 

Isaac Chavarria 


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

Hi Isaac,

 

Thanks you, your explanation was perfect, though I did have an issue with using the activity for comparison but got around it by creating a measure.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.