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! Request now

Reply
Anonymous
Not applicable

How to calculate the percentage based on column and slice selection

Hi team, I am very new to Power BI and come across my first question,  I have a table where contains the sales amount and team, dates, sample as below: 

Agent name Agent TeamSales dateSales total
LucyTeam A30/07/20203
Marin Team A31/09/20202
CharcyTeam B1/08/20201
Chris Team C2/08/20205

 

I am using Agent team as a slice in Power BI,  then I want to calculate the percentage of Sales of each person baes on my selection of teams,  for example, if I dont select any team then it will be calculated based on the whole table, the result will be like: 

 Sales total Percentage
Lucy327.27%
Marin 218.18%
Charcy19.09%
Chris 545.45%

but if I select Team A, the percentage will need to calculates based on the total sales of Team A. 

 Sales total Percentage
Lucy360.00%
Marin 240.00%

I know we can use the "Percentage of grad total" to show similar results, but I would like to create it as a measure so I can re-use this value.

I tried to use DAX below: 

Pct Team =
VAR Personal =
sum('table'[Sales Total])
VAR ALLteam=
SUMX(
all('table'),
'table'[Sales Total]
)
DIVIDE(Personal, ALLteam)
But that won't give what I want, anyone can help pls? : ) 
 
2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Anonymous , Try with allselected

Pct Team =
VAR Personal =
sum('table'[Sales Total])
VAR ALLteam=
SUMX(
allselected('table'),
'table'[Sales Total]
)
DIVIDE(Personal, ALLteam)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

Anonymous
Not applicable

It worked, thanks 🙂 

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Try with allselected

Pct Team =
VAR Personal =
sum('table'[Sales Total])
VAR ALLteam=
SUMX(
allselected('table'),
'table'[Sales Total]
)
DIVIDE(Personal, ALLteam)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

It worked, thanks 🙂 

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