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
AtchayaP
Helper V
Helper V

Powerbi

16587903402311596097367606079798.jpg

this is my table 1 and table 2.

 Level 3 - denotes hierarchy  levels of organisation.

Count of employees- under level 3 there are this many employees and their count.

Skills- employees has their skills..

My question, I want to bring totals employees of table 1 to table 2.

I have attached my expected output picture.

 

Can I know , how it can be achieved?

16587907171511659343850437419352.jpg

2 ACCEPTED SOLUTIONS
MahyarTF
Memorable Member
Memorable Member

Hi,

As you have a common column in both tables, then in Power Query you could merge the table and create a separate table :

1- Select Merge Queries from Home/Merge Queries/Merge queries as a new : (or you could merge in existing table) :

MahyarTF_0-1658794384377.png

2- Select the master table in the first list and child in second, and click on the 'Level 3' and 'Level 3 Group' in each table, then click 'Ok':

MahyarTF_1-1658794481576.png

3- now you have a new table combination of both tables, you could choose the column(s) from the list (by clicking on the icon in the last column in the new table) :

MahyarTF_2-1658794705737.png

4- delete 'Skills' column by right click on the column and selecting Remove

5- After Applying it to Power BI, now you have a table :

MahyarTF_3-1658795020576.png

 

 

Mahyartf

View solution in original post

Hi @AtchayaP ,

I created another sample pbix file(see attachment), please check if that is what you want. You can create a measure as below to get it:

Count of employees from Table 1 = CALCULATE(DISTINCTCOUNT('Table 1'[Employee name]))

yingyinr_0-1659093455356.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

10 REPLIES 10
v-yiruan-msft
Community Support
Community Support

Hi @AtchayaP ,

I created a sample pbix file(see attachment) for you, please check whether that is what you want.

Method1: use DAX

You can create a calculated column as below:

Count of skill employees = 
CALCULATE (
    SUM ( 'Table 1'[Count of employees] ),
    FILTER ( 'Table 1', 'Table 1'[Level 3] = 'Table 2'[Level 3 groups] )
)

yingyinr_0-1658991197714.png

Method2merge Table 1 and Table 2 as suggested by @MahyarTF 

let
    Source = Table.NestedJoin(#"Table 1", {"Level 3"}, #"Table 2", {"Level 3 groups"}, "Table 2", JoinKind.RightOuter),
    #"Expanded Table 2" = Table.ExpandTableColumn(Source, "Table 2", {"Count of employees", "Development status"}, {"Count of employees(development)", "Development status"})
in
    #"Expanded Table 2"

yingyinr_1-1658991317020.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

These are my tables, table 1 about employees, Table 2--- skills- > employees have multiple skills, 

table 3---Development item---> Focussed to do in future.

Table 1

Employee name

arjun

rithik

edvid

tharun

elsa

jose

 

 

 

Table 2

Employee name

skills

arjun

Python

arjun

 data

arjun

excel

rithik

Program

rithik

java

edvid

Chemistry

edvid

,physics,

edvid

,maths,

edvid

biology

tharun

javascript

 

Table 3

Employee name

Development items

arjun

Prepare my team

tharun

Training

elsa

mentorship

jose

Workflow

jose

create model

 

My expected result is, that I want to bring the count of employees as 6 (table 1)  to table 3. Can I know?

 

Expected Output.

Employee name

Development items(count)

Count of employees from table 1

arjun

Prepare my team

 

tharun

Training

 

elsa

mentorship

 

jose

Workflow

 

jose

create model

 

Totals

5

6

Hi @AtchayaP ,

I created another sample pbix file(see attachment), please check if that is what you want. You can create a measure as below to get it:

Count of employees from Table 1 = CALCULATE(DISTINCTCOUNT('Table 1'[Employee name]))

yingyinr_0-1659093455356.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
MahyarTF
Memorable Member
Memorable Member

Hi,

As you have a common column in both tables, then in Power Query you could merge the table and create a separate table :

1- Select Merge Queries from Home/Merge Queries/Merge queries as a new : (or you could merge in existing table) :

MahyarTF_0-1658794384377.png

2- Select the master table in the first list and child in second, and click on the 'Level 3' and 'Level 3 Group' in each table, then click 'Ok':

MahyarTF_1-1658794481576.png

3- now you have a new table combination of both tables, you could choose the column(s) from the list (by clicking on the icon in the last column in the new table) :

MahyarTF_2-1658794705737.png

4- delete 'Skills' column by right click on the column and selecting Remove

5- After Applying it to Power BI, now you have a table :

MahyarTF_3-1658795020576.png

 

 

Mahyartf

The 3rd step you mentioned here:Now you have a new table combination of both tables, you could choose the column(s) from the list (by clicking on the icon in the last column in the new table)----- which one  should I select 

As you need the count, just select the 'Count ....'

Mahyartf

To merge queries, is that column should be common ?

Because I have some differences in in table 1 and table 2

Hi, As we want to create a relation between two tables and bring the rest column(s) based on these columns, should have a common value. this relation is same as the condition between two table in Sql query

Mahyartf

Ok , once i apply this doing in my table will let you know

danextian
Super User
Super User

Hi @AtchayaP ,

 

Please  add a data source that  we anyone  can easily copy-paste (not an image).










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


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

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.