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
0xygen27
Advocate II
Advocate II

How to subtract a group of variables from a column

Dear Community, 

 

I am a new user and working on my first dashboard in Power BI. The file I got has data in weekly frequentcy from different departments, these are all sorted on date. One column is the amount of employees from the department on that specific date, I want to calculate what the total amount of workers is on that date and how many percentage of the total employees are working for that department.

 

The table is like this 

Column A(Date) Column B(Departement) Column C (Profiles,which is how many people there are) Column D (Variable X)

19-02-2017         Department A                   8

19-02-2017         Department B                   9

19-02-2017         Department C                   293

26-02-2017         Department A                  15

26-02-2017         Department B                   8

26-02-2017         Department C                   300

 

So I want to calculate  

Total Employees on that date 

Percentage of employees working for that department on that date 

 

Thanks in advance,

 

0xygen27

 

6 REPLIES 6
Anonymous
Not applicable

Hi @0xygen27

 

Try the following

 

1. Create a measure called TotalByDate

   TotalByDate = Calculate(sum(Table3[ColumnC]), ALLEXCEPT(Table3,Table3[ColumnA]))

2. Createa measure called %toTotal

   %toTotal = Divide(sum(Table3[ColumnC]),[TotalByDate])

 

Replace all Table3 by your tablename. Sample output with the data provided by you.

 

Capture.GIF 

 

If this resolves your issue, please accept it as a solution and also give KUDOS.

 

Cheers

 

CheenuSing

 

Anonymous
Not applicable

Hi @0xygen27,

 

You can try to use below formula which about calculate the running total:

 

Measure:

 

Running total=
var currDepart= LASTNONBLANK(Table[Department],[Department])
return
SUMX(FILTER(ALLSELECTED(Table),Table[Department]=currDepart&&Table[Date]<=MAX(Table[Date])),[Profiles])

 

Regards,

Xiaoxin Sheng

Power BI gives me the return: The MAX function only accepts a column reference as an argument.

Anonymous
Not applicable

Hi @0xygen27,

 

>>Power BI gives me the return: The MAX function only accepts a column reference as an argument.

Can you share us your formula?

 

Regards,

Xiaoxin Sheng

Running total = var currDepart= LASTNONBLANK('database'[Profiel],'database')
return
SUMX(FILTER(ALLSELECTED('database'),'database'[Profiel]
=currDepart&&RELATEDTABLE(Datedimension)<=MAX(Datedimension)),'database'[Profiel])

 

 

Anonymous
Not applicable

Hi @0xygen27,

 

>>RELATEDTABLE(Datedimension)<=MAX(Datedimension)

You need to specify a column from that table, max function not works on table.

 

In addition, if your visual has created from different table, it will be help if you share some sample data.

 

Regards,

Xiaoxin Sheng

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.