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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

Summed Category * static weighted value

Hi all, I've been trying to figure this out for days now with no luck online. Hopefully someone can help me.

So I have a data-set of numbers I'd like to sum up by category then another calculation that gets that total category sum and times it by the weighted value of a particular category as below.

I currently have a measure that computes the following "(TotalNumber - SubNumber) / TotalNumber" : to get the "Total %", then I have a calculated column that has an if statment that says(To reference the weighted values),

IF(Availability_Calculations[Avail_Category] = "Spiders" , 23.5,
IF(Availability_Calculations[Avail_Category] = "Wasps", 23.50,
IF(Availability_Calculations[Avail_Category] = "Ladybirds" , 19.60,
IF(Availability_Calculations[Avail_Category] = "Ants" , 15.70,
IF(Availability_Calculations[Avail_Category] = "Bees" , 17.70,0)))))


Then another column: 

[Total %] * [Weighted_Values]

My logic in Excel that I want to replicate but also the red value I want to have in a measure on its own.

Mike_Infinity2_3-1675262497770.png

Mike_Infinity2_4-1675263164779.png


So my question is, how can I best represent this Excel formula and calculate the total% * the weighted values then following this, show the total % (in red text on the bottom right of the screenshot) So I get my final %?

In Power BI my totals are off. But also, I'd like the percentages to be in a separate measure so I can show it in a card.

 

Mike_Infinity2_5-1675263468755.png

 

 

 

 



2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Anonymous , It should be table or some group level

 

a measure

 

sumx( Availability_Calculations,[Total %] * [Weighted_Values])

 

or

 

sumx( values(Availability_Calculations[Avail_Category]) ,calculate([Total %] * max([Weighted_Values]) )  )

View solution in original post

v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

You can try the following methods.
Initial data:

vzhangti_0-1675403055610.png

Measure:

Total% = DIVIDE(SUM('Table'[SubNumber])-SUM('Table'[TotalNumber]),SUM('Table'[SubNumber]))
Weighted% = SUM('Table'[Weight])*[Total%]/100
Measure = SUMX('Table',[Weighted%])

vzhangti_1-1675403139276.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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
v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

You can try the following methods.
Initial data:

vzhangti_0-1675403055610.png

Measure:

Total% = DIVIDE(SUM('Table'[SubNumber])-SUM('Table'[TotalNumber]),SUM('Table'[SubNumber]))
Weighted% = SUM('Table'[Weight])*[Total%]/100
Measure = SUMX('Table',[Weighted%])

vzhangti_1-1675403139276.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

Anonymous
Not applicable

Thanks for the reply both!

If I use @amitchandak  calculation of "sumx( values(Availability_Calculations[Avail_Category]) ,calculate([Total %] * max([Weighted_Values]) )  )" it shows up correctly on both the weighted% total and values and if I use @v-zhangti other calculations it works hand in hand for the other sections! Thank you both!

 
amitchandak
Super User
Super User

@Anonymous , It should be table or some group level

 

a measure

 

sumx( Availability_Calculations,[Total %] * [Weighted_Values])

 

or

 

sumx( values(Availability_Calculations[Avail_Category]) ,calculate([Total %] * max([Weighted_Values]) )  )

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors