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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
CloudMonkey
Post Prodigy
Post Prodigy

Calculate the sum of a measure

Hi,

 

I have a column of sales volumes with the rows being branch numbers.

 

I'd like to a calculated measure showing the "% weighting " versus the total. I know I can use "Show Value As -> % of Grand Total" but I'd like the result in a calculated measure that I can use elsewhere.

 

Please can you tell me how to calculate the sum of the volumes? (in order to allow me to calculate the % weighting)

 

Thanks,

 

CM

1 ACCEPTED SOLUTION

for a measure (assuming it's sum of sales) syntax would look like this

% weighting all selected = 
VAR CurrentSales = [your measure]
VAR AllSelectedSales = CALCULATE([your measure],ALLSELECTED('Table'))
RETURN
DIVIDE(CurrentSales,AllSelectedSales)

without sample data & measure syntax from your side I cannot provide more specific info



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

View solution in original post

5 REPLIES 5
Stachu
Community Champion
Community Champion


depending whether you need the weight to be as per overall total or currently selected you may select between the 2:

% weighting all selected = 
VAR CurrentSales = SUM('Table'[Sales Volume])
VAR AllSelectedSales = CALCULATE(SUM('Table'[Sales Volume]),ALLSELECTED('Table'))
RETURN
DIVIDE(CurrentSales,AllSelectedSales)
% weighting all= 
VAR CurrentSales = SUM('Table'[Sales Volume])
VAR AllSales = CALCULATE(SUM('Table'[Sales Volume]),ALL('Table'))
RETURN
DIVIDE(CurrentSales,AllSales)


Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Is there a way to sum calculated measures? (I think you are summing calculated fields?)

 

Thanks

for a measure (assuming it's sum of sales) syntax would look like this

% weighting all selected = 
VAR CurrentSales = [your measure]
VAR AllSelectedSales = CALCULATE([your measure],ALLSELECTED('Table'))
RETURN
DIVIDE(CurrentSales,AllSelectedSales)

without sample data & measure syntax from your side I cannot provide more specific info



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Thank you this is awesome

Brilliant, thank you Stachu Smiley Happy This may lead to a follow up question but I'll start another thread...

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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