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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register 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
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.