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
wneiton
Resolver I
Resolver I

Create a new table from sum columns from existing tables

Help, please 

I need create a new table from another two or more table. 

e.g. 

I have two independent tables (no relationships) in Power BI. Each table has a column with values, and I need to sum theses values and create another table with the result of this sum. example below

 

 

Capturar.JPG

 

thanks!!

 

1 ACCEPTED SOLUTION

Hi, @Ashish_Mathur @Greg_Deckler

 

I have solved my problem using two functions: 

DISTINCT and SWITCH. 

 

1 - I've combined all my tables using append queries, created Append2 Table. 

 

2 - Second I have created new table. 

Criterios = DISTINCT(Append2[Attribute]) and 

valores = SWITCH(Criterios[Attribute];"impacto1";[Media_Impacto1];"impacto2";[Media_Impacto2];"impacto3";[Media_Impacto3];"visao1";[Media_Visao];"visao2";[Media_Visao2];"visao3";[Media_Visao3])

 

3  - Then I've pulled Attribute and valores to the visual, now I can order by valores(value)

 

ps: Media_Impacto is a previous measure that I had created for each table.

 

Wneiton

View solution in original post

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi,

 

You may download my PBI file from here.

 

Hope this helps.

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Greg_Deckler
Super User
Super User

Hmm, I would create a table using enter data that was just a single column with the text "table01" and "table02" in it as rows. Then you could create a calculated column like:

 

Column = IF([Column]="table01",SUMX('Table1'[Column]),SUMX('Table2'[Column]))

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

hi @Greg_Deckler @Ashish_Mathur

Yours example, helped me, thanks, but here's my true reality.

I need to do an arithmetic sum of all impacto1 values and create a new table as a result. e.g

 

Capturar.JPG

 

New_table

Column     |    values 

impacto1        1,6 

impacto2        2,3 

impacto3        2,8

....

impacto20      1,5 

 

Hi,

 

Drag the Attribute column to the row labels of the Table visual and filter it on "Begins with" Impacto.  Write this measure

 

=SUM(Data[Value])

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

For each table I have already created a measure , now I need to combine all 20 measure from 20 tables in one new single table, like below. Automatically, with DAX formula. 

 

New_table

Column     |    values 

impacto1        1,6 

impacto2        2,3 

impacto3        2,8

....

impacto20      1,5

Hi, @Ashish_Mathur @Greg_Deckler

 

I have solved my problem using two functions: 

DISTINCT and SWITCH. 

 

1 - I've combined all my tables using append queries, created Append2 Table. 

 

2 - Second I have created new table. 

Criterios = DISTINCT(Append2[Attribute]) and 

valores = SWITCH(Criterios[Attribute];"impacto1";[Media_Impacto1];"impacto2";[Media_Impacto2];"impacto3";[Media_Impacto3];"visao1";[Media_Visao];"visao2";[Media_Visao2];"visao3";[Media_Visao3])

 

3  - Then I've pulled Attribute and valores to the visual, now I can order by valores(value)

 

ps: Media_Impacto is a previous measure that I had created for each table.

 

Wneiton

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.