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
TSI
Advocate I
Advocate I

Combining multiple tables that are based on measures

Hi there!

 

I'm new to Power BI and need help combining 3 tables. They are based on measures, hence UNION doesn't work.

Here's what the tables look like (with different column headings except Projected Year), and how they should be combined:Gender EvolutionGender EvolutionWould anyone be able to help? Thank you!

 

 

1 ACCEPTED SOLUTION

Hi @TSI ,

 

Please check the following steps as below.

 

1. Create a calculated table as below.

 

Table = GENERATESERIES(2019,2021,1)

2. Create measures to get the excepted result.

2019 = 0.415
2020 = [2019]+SELECTEDVALUE(Attrition[Attrition])*SELECTEDVALUE('Women Hired %'[Women Hired %])*[2019]
2021 = [2020]+ SELECTEDVALUE(Attrition[Attrition])*SELECTEDVALUE('Women Hired %'[Women Hired %])*[2020]
Measure = SWITCH(MAX('Table'[Value]),2019,[2019],2020,[2020],2021,[2021])

Capture.PNG

 

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

View solution in original post

6 REPLIES 6
AlB
Super User
Super User

Hi @TSI 

If thye are all measures, you can just:

 - Place [Projected Year] in rows of a matrix visual  and place both  measures [Projected Male %] and [Projected Female %] in values of the matrix visual

You do not show how you built the measures so if the above does not work please show the code for the measures and the data tables you involved in the calculation.

Show your sample data in text-tabular format in addition to (or instead of) the screen captures. That allows people trying to help to readily copy the data and run a quick test, plus it increases the likelihood of your question being answered. Just use 'Copy table' in Power BI and paste it here. Or, ideally, share the pbix (beware of confidential data).

 

 

 

Hi @AlB ,

Thank you for the reply and tips on posting questions.

I tried using a matrix visual, but ended up with multiple columns, not sure if I did it wrong:Gender evolution tables1.jpg

 

The issue I have is that the Gender % projection is a recursive calculation, simplified below:Gender evolution tables2.jpg

 

I tried to split it into measures to get the projection for 2020 and 2021, and add it back into a single table to get the visualisation. 

Is there an easier way to do this? Excel is the obvious choice but we'd like to link the Gender % projection to our current dashboard. 

 

Thanks for your help!

Hi @TSI ,

 

Could you please share your sample data to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.

 

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

Hi @v-frfei-msft ,

 

Please find sample data here.

 

Appreciate any insights you have.  

Hi @TSI ,

 

Please check the following steps as below.

 

1. Create a calculated table as below.

 

Table = GENERATESERIES(2019,2021,1)

2. Create measures to get the excepted result.

2019 = 0.415
2020 = [2019]+SELECTEDVALUE(Attrition[Attrition])*SELECTEDVALUE('Women Hired %'[Women Hired %])*[2019]
2021 = [2020]+ SELECTEDVALUE(Attrition[Attrition])*SELECTEDVALUE('Women Hired %'[Women Hired %])*[2020]
Measure = SWITCH(MAX('Table'[Value]),2019,[2019],2020,[2020],2021,[2021])

Capture.PNG

 

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

Hi @v-frfei-msft , this is brilliant!

Thank you so much for the elegant solution. 

First time I've seen SWITCH, definitely looking it up.

Managed to create this line chart by following your steps:


Gender evolution line chart1.jpg

 

 

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.