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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

Joining two tables and applying year filter w/o using merge queries

Hi, I recently started using POWER BI and I am trying to do a single join as I would do in SQL. 

 

I have two tables: 

 

Table A
   
YearCustomer IDAccount ID
201810001
201820002
201830003
201840004
201810008
201820007
201830006
201740005

 

and 

 

Table B
  
Customer IDCustomer Name
1000A
2000B
3000C
4000D

 

The table that I want to get is a summary table showing the "Number of Accounts" by "Customer Name" where "thisyear" filter is applied (without explicitly typing 2018). 

 

Is this something that I can achieve without using merge queries but using a DAX function?

 

Table C
Customer NameNumber of Accounts
A2
B2
C2
D1

 

Thank you for the help!

Kerem

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Anonymous,

 

You should use the relationship between tables to make this and then just add it to a table visual the Name from TableB and the Account from TableA.

 

For the account select the sumarization COUNT. 

 

If you add a filter based on year you can then get the expected result.

 

However if you don't want to have a slicer and just want to filter the count based on the current year without any selection you can add the following measure:

Number of accounts = CALCULATE(COUNT(TableA[Account ID]); TableA[Year] = YEAR(TODAY()))

Then use this measure on your table. Check below the two option on the image:

count.gif

 

Check attach PBIX file with example.

 

Regards.

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

2 REPLIES 2
MFelix
Super User
Super User

Hi @Anonymous,

 

You should use the relationship between tables to make this and then just add it to a table visual the Name from TableB and the Account from TableA.

 

For the account select the sumarization COUNT. 

 

If you add a filter based on year you can then get the expected result.

 

However if you don't want to have a slicer and just want to filter the count based on the current year without any selection you can add the following measure:

Number of accounts = CALCULATE(COUNT(TableA[Account ID]); TableA[Year] = YEAR(TODAY()))

Then use this measure on your table. Check below the two option on the image:

count.gif

 

Check attach PBIX file with example.

 

Regards.

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

Hi @MFelix thank you for your reply. It worked. And thanks for showing the solution in two different ways. I used the measure. 

 

Very helpful!

Kerem

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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