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
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
Employee
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
Employee
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
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.

Top Kudoed Authors