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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
5mvn
New Member

Subtract 2 different data

Hello everybody! I wanted to ask for help because like many of you I come from Excel and I am having a hard time learning how to formulate in powerBI. First of all forgive me if it is very obvious!

 

I have two tables:

- Table A: year of entry, number of registrations. I have calculated it as COUNT(Date of entry)

- Table B: year of leave, number of leaves. I have calculated it as COUNT(Date of leaving)

 

I would like to create a net growth chart (Table A - Table B) but I am unable to relate the data for the formula "Table A" - "Table B" and the result of this subtraction gives me 0.

 

In this example it should subtract me at least 2018, but it fails to link one subtraction to another.

 

5mvn_2-1689155214605.png

Could you help me?

 

Thanks in advance!

4 REPLIES 4
Nithinr
Resolver III
Resolver III

can you please share pbix file if possible, just curious how you are calculating variance, is it a column based substraction like below

column='Table (2)'[data1]-RELATED('Table'[Data])

Hi Nithinr, thanks again for your time. This is the most accurate formula I have done, but it does not work still:

 

CALCULATE(COUNT(Sheet1[Year of registration]),Sheet1[Incorporation date])-calculate(COUNT(Sheet1[Year of leave]),Sheet1[Leave date])
 
Here I realized the problem lies not with the formula but within the graphic that shows Registration-Leaves, because I created in excel a new column that can relate registration and leaves in the same year so that it can show in the graphic both data with the same info. I created this column in excel:

=IF((yearofleave)>=2018;year(yearofleave);if(hiringyear=0;"";year(hiringyear)))
 
The problem is that now I show as "2023" people that got hired in 2010 -for example- but their leave year is 2023. So 2023 does not only show people that got hired in 2023 but also people that left the company this year.
 
Thats why when I do in powerBI the substraction the final result does not match, so I guess the solution is to either create a column that can relate both years correctly or to face the problem with a different approach
Nithinr
Resolver III
Resolver III

Check if the relationships are configured between two tables. let me know if you are still getting the same variance.

re.pngrelation.png

Yeah, still same problem, thanks though! I even tried moving all to the same table so now I have everything in one table and still doesn't work

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.

Top Solution Authors