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

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

Reply
Anonymous
Not applicable

Scatter plot average line

Hi everyone, I need your help urgently ;_:

 

I am trying to get an average line that takes the average of the dot points shown in the scatter plot. I'm using a combination of slicers and SWITCH formula. 

 

dominicliman72_0-1595644127173.png

 

The problem would be in the average line for Average Risk Rating Filter. When I click Reward 2, it gives me the correct average line of 1.92. But when I click Reward 1, it still gives me the average line of 1.92. It should give me 1.67, which is the average risk rating of the 2 points shown in the scatter plot (Project 1 and 2, because Project 3 and 4 do not have Reward 1 value). 

 

dominicliman72_1-1595644630974.png

Average Reward 1 = AVERAGE(Sheet1[Reward 1])
Average Reward 2 = AVERAGE(Sheet1[Reward 2])
Reward Selection = SWITCH( TRUE(), VALUES('Dynamic Reward'[Dynamic Reward]) = "Reward 1", [Average Reward 1], VALUES('Dynamic Reward'[Dynamic Reward]) = "Reward 2", [Average Reward 2], BLANK())
Average Risk Rating = (SUM(Sheet1[Risk Rating 1]) + SUM(Sheet1[Risk Rating 2]) + SUM(Sheet1[Risk Rating 3]))/ (COUNT(Sheet1[Risk Rating 1]) + COUNT(Sheet1[Risk Rating 2]) + COUNT(Sheet1[Risk Rating 3]))
Average Risk Rating Filter = CALCULATE([Average Risk Rating], FILTER('Dynamic Reward', 'Dynamic Reward'[Reward Selection] > 0))

 

I know the solution should be in the DAX formula for Average Risk Rating Filter, but I can't seem to find the correct DAX formula. 

 

Thank you so much for the help!

 

1 ACCEPTED SOLUTION
AllisonKennedy
Super User
Super User

Update your Reward Selection to use SELECTEDVALUE which will allow the SWITCH function to actually make it to the BLANK() part:

Reward Selection = SWITCH( TRUE(), SELECTEDVALUE('Dynamic Reward'[Dynamic Reward]) = "Reward 1", [Average Reward 1], SELECTEDVALUE('Dynamic Reward'[Dynamic Reward]) = "Reward 2", [Average Reward 2], BLANK())

Then try this for your Average Risk Rating:
Average Risk Rating = AVERAGEX(FILTER(Sheet1,[Reward Selection]>0 ), (Sheet1[Risk Rating 1]+Sheet1[Risk Rating 2]+Sheet1[Risk Rating 3])/3)

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

8 REPLIES 8
AllisonKennedy
Super User
Super User

Update your Reward Selection to use SELECTEDVALUE which will allow the SWITCH function to actually make it to the BLANK() part:

Reward Selection = SWITCH( TRUE(), SELECTEDVALUE('Dynamic Reward'[Dynamic Reward]) = "Reward 1", [Average Reward 1], SELECTEDVALUE('Dynamic Reward'[Dynamic Reward]) = "Reward 2", [Average Reward 2], BLANK())

Then try this for your Average Risk Rating:
Average Risk Rating = AVERAGEX(FILTER(Sheet1,[Reward Selection]>0 ), (Sheet1[Risk Rating 1]+Sheet1[Risk Rating 2]+Sheet1[Risk Rating 3])/3)

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Anonymous
Not applicable

Hi Allison, 

 

It works! I can now get the average line of 1.67

For the formula average risk rating, 

 

Average Risk Rating = AVERAGEX(FILTER(Sheet1,[Reward Selection]>0 ), (Sheet1[Risk Rating 1]+Sheet1[Risk Rating 2]+Sheet1[Risk Rating 3])/3)

 

Is there anyway to change the "divide by 3" to the count of how many risk rating appeared? So assuming the new data set as follow, for Project 4, the average risk rating will then be 1.5

 

Project NameRisk Rating 1Risk Rating 2Risk Rating 3Reward 1Reward 2
Project 111156
Project 222374
Project 3333 3
Project 41 2 2
Anonymous
Not applicable

I was able to find the solution by changing the formula to below

 

Average Risk Rating = CALCULATE([Average Risk Rating], FILTER(Sheet1,[Reward Selection]>0 ))
 
Thank you again for the help!
 
 
AllisonKennedy
Super User
Super User

Maybe try AVERAGEX or a more dynamic formula rather than calculating the average yourself.

I don't fully understand how you are calculating risk rating, so I don't think this formula gets you there still, but start thinking in terms of the table context, maybe use the FILTER function or similar approach:
Average Risk Rating = AVERAGEX(Sheet1, Sheet1[Risk Rating 1] + Sheet1[Risk Rating 2] + Sheet1[Risk Rating 3])

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Anonymous
Not applicable

Hi Allison,

 

Thank you for the reply. The average risk rating is your normal average of the risk rating with the following formula;

Average Risk Rating = (Risk Rating 1 + Risk Rating 2 +  Risk Rating 3)/3 

 

I tried using AVERAGEX, but it didn't give me the average line of 1.92 that I wanted.

 

 

@Anonymous I kind of get the Risk Rating 1 +2 + 3 / 3 for total number of Risk Ratings, but since these are in Columns rather than rows, it doesn't play so nicely with DAX, and so when you use AVERAGEX, it will add Risk Rating 1 + 2 + 3, but then what do you want to divide by? And then do you take an average of those averages?

So for your example it should be:

AvgRiskRating =
AVERAGEX(Sheet1,
(Sheet1[Risk Rating 1] + Sheet1[Risk Rating 2] + Sheet1[Risk Rating 3])
/3
)

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

amitchandak
Super User
Super User

@Anonymous , In case you want switch measure using slicer , refer this.

https://community.powerbi.com/t5/Desktop/Slicer-MTD-QTD-YTD-to-filter-dates-using-the-slicer/td-p/500115

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi, 

 

Thank you for the reply but I am already able to switch measure using the slicer. The problem lies elsewhere.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.