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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. 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)

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)

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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