Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I have to do identical reports from 2 differerent PostgresSQL databases. Ideally, I would be able to merge the two queries so that I just have to create the report once. However, I would still like to be able to identify which database the information came from so I can filter. One database is TEST and one is PRODUCTION. They both have identical fields and there is nothing in the data that would indicate which database each record comes from.
Anyone have any ideas on this? Is there a way to indicate which database each record comes from that would also apply to new records when I refresh?
Solved! Go to Solution.
You may refer to the following post.
https://community.powerbi.com/t5/Desktop/displaying-source-table-name-in-append-field/td-p/485400
for example, if u get data from odbc
Try to create table with db_id like
and add new column with subquery like
=Table.AddColumn(Source, "Custom", each Odbc.Query([db_name],"select * from table_name"))
Next step expand data and create new primary key, merge db_name and primary key table.
Unfortunately, this model don't support scheduled update in power bi service.
@schwinnen Try adding an additional field in your SELECT statement (using SQL Statment) option while importing. Something, similar to this...
SELECT c1,c2,'TEST' as DB FROM TEST.Table1 UNION ALL SELECT c1,c2,'PRODUCTION' as DB FROM PRODUCTION.Table2
Proud to be a PBI Community Champion
Thank you. I will try this when I have a chance. It will be more complicated than what you have provided because the name of the databases and the tables contained within them are longer than what I stated earlier. And as I am not an expert at SQL, I will have to figure out exactly how to write my statement.
You may refer to the following post.
https://community.powerbi.com/t5/Desktop/displaying-source-table-name-in-append-field/td-p/485400
That worked. Thank you very much!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
61 | |
56 | |
55 | |
36 | |
34 |
User | Count |
---|---|
77 | |
73 | |
45 | |
45 | |
43 |