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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Meerakhanna
Helper I
Helper I

simple calculation based on aggregate value reg,.

Hi,

I surprise if i can do a calculation over an aggregated value in power BI. Please see to the below screen shot & table. I need that 'AB on Total' value to be calculated on run in Power BI. Is it possible? - Thank you!

 

 ABCTotalAB on Total
India100705222276.6%
China120308623663.6%

ABonTotal.JPG

 

1 ACCEPTED SOLUTION
Eric_Zhang
Microsoft Employee
Microsoft Employee

@Meerakhanna

 

If you have data as below, you would first pivot the table.

Capture.PNG

 

Then create and apply two measures in a Matrix visual.

 

Total = SUM([A]) +SUM([B])+SUM([C])

AB on Total = (SUM([A])+SUM([B]))/[Total]

Capture.PNG

 

View solution in original post

6 REPLIES 6
Eric_Zhang
Microsoft Employee
Microsoft Employee

@Meerakhanna

 

If you have data as below, you would first pivot the table.

Capture.PNG

 

Then create and apply two measures in a Matrix visual.

 

Total = SUM([A]) +SUM([B])+SUM([C])

AB on Total = (SUM([A])+SUM([B]))/[Total]

Capture.PNG

 

Eric!

Thanks for that solution. It worked for me 🙂 

@Meerakhanna

Great to hear that. 🙂

BhaveshPatel
Community Champion
Community Champion

Hi There,

 

You can use the newly added functionality Invoke Custom Function in the Query Editor for this and It would be more creative solution as you can use them for other type of similar tasks as well.

 

To do so, 

 

1.Add a Blank query and Write the below code:

(Qscore as number, Rscore as number,Sscore as number) => Qscore + Rscore + Sscore

 

Note: Change the Code as per your requirement as your calculation are different than shown here.

 

M11.PNGM10.PNGM12.PNGM13.PNG

 

 

2. Go to your original query and Under the Add Column Tab, Select Invoke Custom Function.

and Choose the appropriate options and it will give you desire results. 

 

 

                                                                        OR

 

You can use custom column in the query editor to achive the desired results.

 

Let me know if you get stuck.

Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.

Hi Bhavesh!

Thanks for the reply.

But the thing is I 've the data as unpivoted column values. I had made that as matrix so as to show up my requirement. 

I'll have to have some kind of work around anyway....I m still working on 😞 

I am not that good with the language used here so facing some issue with writing formulae....

Meerakhanna
Helper I
Helper I

I think that its not a simple calculation... 😐

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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