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
nerd2000
Regular Visitor

displaying source table name in append field

I am appending several queries eg: 

query A

query B

query C

 

I want to create a custom column in the append result query that will display the source query name the record was from eg:

 

Append results:

 

fruit         qty        source query

apple        23        query A

pear           4         query A

orange       33       query B

grapefruit    4        query B

....and so on

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@nerd2000,

 

You may change code in The Advanced Editor.

    Source = Table.Combine({Table.AddColumn(#"query A", "source query", each "query A")
                            , Table.AddColumn(#"query B", "source query", each "query B")
                            , Table.AddColumn(#"query C", "source query", each "query C")})
Community Support Team _ Sam Zha
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

7 REPLIES 7
bluefalcon
Frequent Visitor

Thank you, the problem was soluted

ManoukUBN
Frequent Visitor

There is a workaround using #sections now!

Get List of Queries in Power BI - RADACAD

lucaspon
New Member

This is nice but, what if I have like 100 tables I need to append? How can we make this code dynamic so that it gets the table name for each row?

v-chuncz-msft
Community Support
Community Support

@nerd2000,

 

You may change code in The Advanced Editor.

    Source = Table.Combine({Table.AddColumn(#"query A", "source query", each "query A")
                            , Table.AddColumn(#"query B", "source query", each "query B")
                            , Table.AddColumn(#"query C", "source query", each "query C")})
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Not pretty, but it worked, thank you.

This really should be a built-in function, it would make the append query much more useful.

Thanks a lot for this. It came in very handy. I needed to combine 72 Tables for cleaning. It worked well.

Wonderful solution, thank you! Came in very handy in my work today.

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.

Top Solution Authors