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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors