- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
UNION function mixes columns
Hi, I know that this subject has been discussed earlier in this forum, but I still don't know how to solve my issue.
I am making a PWBI model based on data from two different ERP systems. I have many examples where I have to combine two tables with different number of columns.
I tried to solved this problem by manipulating the tables before I am making the new table with used of the UNION function, ie add a new column to the table where it is missing and sets the values to "0" or blank (New column = 0). BUT it is not working, in the new table the columns are mixed.
I have used the UNION function (Power BI DAX) before with big success - so why does it not work this way?
I have few millions of row in my tables - and I used Sql queries to get the data.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I used Selectcolumns first and then the UNION function - and it worked great!!!!!!
This is a much more tidy way to do it - it provides a clear distinction between extrated and transformed data.
Thank you very much - a learn something new 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I found the following helpful in how JOINs work: https://stackoverflow.com/questions/38549/what-is-the-difference-between-inner-join-and-outer-join
I had a similar problem, I think.
I join two tables (TableA, TableB) that both have unique timestamps, the relationships/JOIN in PWBI didn't connect them as I wanted, so I created a new table (TableAll) with ALL the values from both TimeStamp columns, then linked TableA:TimeStamp to TableAll:TimeStamp, and TableB:TimeStamp to TableAll:TimeStamp.
This way, when I use TableAll:TimeStamp as an axis, I can then reference data from both TableA and TableB.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
can you use selectcolumns dax function to list the order it should go in?
If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!
Proud to be a Super User!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do you mean, first making two new tables by use of Selectcolumns - and afterwards combined those two with use of UNION?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I used Selectcolumns first and then the UNION function - and it worked great!!!!!!
This is a much more tidy way to do it - it provides a clear distinction between extrated and transformed data.
Thank you very much - a learn something new 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have the same issue, can you please explain how you solved it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
great
If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!
Proud to be a Super User!

Helpful resources
Subject | Author | Posted | |
---|---|---|---|
09-10-2024 02:18 PM | |||
10-24-2024 04:15 PM | |||
11-21-2024 02:40 AM | |||
11-18-2024 09:36 PM | |||
Anonymous
| 10-05-2021 04:03 AM |
User | Count |
---|---|
141 | |
112 | |
83 | |
63 | |
47 |