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
aasthana
New Member

Weighted Average Rate of Percentage as a straight line in graph

Hi, 

I am trying to calculate Weighted avergae of Adverse Rate which should appear as straight line. In the cluster chart, we can find Analytics Pane where We get average line but that’s giving Regular average. We need weighted average and that too in the form of straight line of Adverse Rate.

 

Pic 1.png

1 ACCEPTED SOLUTION

Hey,

 

I think you have to change the DAX of your Weighted Average to this:

 

Weighted Avg = 
--VAR __CATEGORY_VALUES = VALUES('Sheet1'[Fulfillment Center])
VAR __CATEGORY_VALUES = ALLSELECTED('Sheet1'[Fulfillment Center])
RETURN
	DIVIDE(
		SUMX(
			--KEEPFILTERS(__CATEGORY_VALUES),
            __CATEGORY_VALUES,
			CALCULATE([Adverse Rate] * SUM('Sheet1'[Adverse]))
		),
		SUMX(
			--KEEPFILTERS(__CATEGORY_VALUES),
            __CATEGORY_VALUES,
			CALCULATE(SUM('Sheet1'[Adverse]))
		)
	)

Then your chart looks like this:
image.png

Hopefully, this is what you are looking for.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

4 REPLIES 4
TomMartens
Super User
Super User

Hey,

 

you have to create a measure that reflects the weighted average, then you can use the "Line and stacked column chart" or the "Line and clustered column chart" and use the measure for the Line value well

 

image.png

 

If you need help to create a measure, please consider to create a pbix or xlsx file that contains sample data and reflects your data model, upload the file to onedrive or Dropbox, and share the link.

 

Hopefully, this is what you are looking for.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

I already tried to pull the avg measure in Line Values however this is not constant line. It's dynamic. If you see in the pic below. 

 

My problem is:

1. It should consider weighted avg not regular average. 

2. The Weighted Avg line should be constant.

 

Link of PBIX file and source file are as follows:

https://1drv.ms/f/s!Ao3I1Gsi9dPuiFYx1XozRsY_HGSg

 

Pic 3.PNG

Hey,

 

I think you have to change the DAX of your Weighted Average to this:

 

Weighted Avg = 
--VAR __CATEGORY_VALUES = VALUES('Sheet1'[Fulfillment Center])
VAR __CATEGORY_VALUES = ALLSELECTED('Sheet1'[Fulfillment Center])
RETURN
	DIVIDE(
		SUMX(
			--KEEPFILTERS(__CATEGORY_VALUES),
            __CATEGORY_VALUES,
			CALCULATE([Adverse Rate] * SUM('Sheet1'[Adverse]))
		),
		SUMX(
			--KEEPFILTERS(__CATEGORY_VALUES),
            __CATEGORY_VALUES,
			CALCULATE(SUM('Sheet1'[Adverse]))
		)
	)

Then your chart looks like this:
image.png

Hopefully, this is what you are looking for.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Yes. This was exactly what I was looking for,

 

Thanks a lor for quick resolution.

 

-Ashish

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.