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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
nosaj03
Helper II
Helper II

Creating a column with a sum of another column that repeats each row

Hey all, 

 

I am a complete noob at this so accept my apologies in advance if this is a very basic question.

 

Lets say I have a table of employee sales data for a specific office. 

 

I want to add a column that shows the total sales of the office so that I can also show what percentage their sales makes up from the total sales of the group.

 

How do I go about adding the column of total sales?

 

Every time I use the sum function for sales, it only provides me the sum for the individual employees and not of the group

 

Any help would be greatly appreciated. 

 

EmployeeSalesGroup SalesVariance
Emily1010010%
Joe2010020%
Sarah2010020%
Bill3010030%
John1010010%
Lisa1010010%
    
1 ACCEPTED SOLUTION
kentyler
Solution Sage
Solution Sage

2measures.PNG

Here you go.

Measure for calculating total sales:

Group Sales Measure = calculate(sum('Table'[Sales]),all('Table'[Employee]))
Measure for calculating variance
Variance Measure = VAR total_sales = [Group Sales Measure]
var individual_sales = selectedvalue('Table'[Sales])
RETURN Divide(individual_sales,total_sales)
I do a little video with commentary soon




Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


View solution in original post

7 REPLIES 7
kentyler
Solution Sage
Solution Sage

2measures.PNG

Here you go.

Measure for calculating total sales:

Group Sales Measure = calculate(sum('Table'[Sales]),all('Table'[Employee]))
Measure for calculating variance
Variance Measure = VAR total_sales = [Group Sales Measure]
var individual_sales = selectedvalue('Table'[Sales])
RETURN Divide(individual_sales,total_sales)
I do a little video with commentary soon




Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


@kentyler thank you so much for your expertise! It worked with unfiltered data but when the data is filtered ie filtering for a specific group of a company that has many groups, the data only returns the individual sales again.

 

How do I work around that?

that would be a variation on the theme

if you'd like to do a screen share to explore the possible solution

email me. i'm ken at 8thfold dot com

other wise please post some sample data, and we'll see if we can work it out

 





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


@kentyler actually I figured it out. I used the ALLSELECTED function with the names of Employee and group and it worked perfectly. Thanks again for all of your help.!!!!

Great Work!





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


I often feel its hard to provide enough context in a written answer. So here's a little video https://youtu.be/kW6JUh5mQ6I 





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


kentyler
Solution Sage
Solution Sage

This is what the ALL() function is in DAX for. 

I'll post a sample shortly.





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors