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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Calculating row count from two across different tables

Hello, i have a sql script that works fine when running in sql database. The scripts looks like this.

SELECT
A.Code,
count ( i.[ID])
FROM [ServingDB].[dbo].[Table_A] A
inner join Table_B B
on A.regnumber = B.regnumber and A.Number = B.Number
group by A.Code
order by A. Code desc

 

Now i want to implement the same logic in Powerbi ? How do i do it?

 

 

2 ACCEPTED SOLUTIONS
PC2790
Community Champion
Community Champion

Hey @Anonymous ,

 

It totally depends on how you want your end data to look like.

You can merge the two tables in Power Query ased on regnumber and Number and group by Code to get the count

like below:

PC2790_0-1652967115279.png

You can get the desired result.

View solution in original post

Anonymous
Not applicable

Thanks a lot again, i will accept this as an answer.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Thanks a lot again, i will accept this as an answer.

PC2790
Community Champion
Community Champion

Hey @Anonymous ,

 

It totally depends on how you want your end data to look like.

You can merge the two tables in Power Query ased on regnumber and Number and group by Code to get the count

like below:

PC2790_0-1652967115279.png

You can get the desired result.

Anonymous
Not applicable

Thank you very much, i will give it a try now. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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