Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

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?

 

 

  • 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:

    You can get the desired result.

  • Anonymous's avatar
    Anonymous
    4 years ago

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

3 Replies

  • PC2790's avatar
    PC2790
    Icon for Community Champion rankCommunity 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:

    You can get the desired result.

    • Anonymous's avatar
      Anonymous
      Not applicable

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

  • Anonymous's avatar
    Anonymous
    Not applicable

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