Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
I am combining data from two different systems in order to make a report on Power BI.
Old data looks like this. Only one row per day.
Date | Category | Details |
01/01/2020 | A | blah blah |
01/02/2020 | B | yada yada |
New data looks like this.
Date | New Category | New Subcategory | Details |
01/03/2020 | C | E | blah blah |
01/03/2020 | D | F | yada yada |
01/04/2020 | D | G | lalalalala |
Say we switch to the new system by 01/03/2020. I need these two tables to be combined to one table, where data before 01/03/2020 to be pulled from old data, and data after 01/03/2020 to be pulled from new data. I had recoded [Category] from old data to [New Category] and [New Subcategory] using DAX (use Switch to create a column), and I would like to stack these two tables together like the following
Date | New Category | New Subcategory | Details |
01/01/2020 | (recoded to) C | (recoded to) F | blah blah |
01/02/2020 | (recoded to) C | (recoded to) G | yada yada |
01/03/2020 | C | E | blah blah |
01/03/2020 | D | F | yada yada |
01/04/2020 | D | G | lalalalala |
How can I make that happen? I cannot append these two tables using Power Query because columns created using DAX are invisible in Power Query. I am very stuck... help!
Solved! Go to Solution.
@Anonymous You can use the UNION function to combine two tables in DAX, but I would strongly look at the calculated columns you created in DAX and see if you can push them back into Power Query. I avoid Calculated Columns at all costs. Then you can easily use the Append (Table.Combine()) functionality in Power Query. Remember, modeling is best done in Power Query, and Analysis is best done in DAX. Appending tables and adding columns is generally a modeling issue, and should be done in DAX in the rarest of cases.
In general, try to avoid calculated columns. There are times to use them, but it is rare. Getting data out of the source system, creating columns in Power Query, or DAX Measures are usually preferred to calculated columns. See these references:
Calculated Columns vs Measures in DAX
Calculated Columns and Measures in DAX
Storage differences between calculated columns and calculated tables
Creating a Dynamic Date Table in Power Query
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingHi @Anonymous ,
You could refer to @edhans and @parry2k 's suggestions to combine table. In addition, if possible, could you please explain the logic of first two rows, why it show C and F , G? Is this based other value or just fixed value? Then I will try to understand it and test this in my environment.
Date | New Category | New Subcategory | Details |
01/01/2020 | (recoded to) C | (recoded to) F | blah blah |
01/02/2020 | (recoded to) C | (recoded to) G | yada yada |
Best Regards,
Zoe Zhi
@Anonymous You can use the UNION function to combine two tables in DAX, but I would strongly look at the calculated columns you created in DAX and see if you can push them back into Power Query. I avoid Calculated Columns at all costs. Then you can easily use the Append (Table.Combine()) functionality in Power Query. Remember, modeling is best done in Power Query, and Analysis is best done in DAX. Appending tables and adding columns is generally a modeling issue, and should be done in DAX in the rarest of cases.
In general, try to avoid calculated columns. There are times to use them, but it is rare. Getting data out of the source system, creating columns in Power Query, or DAX Measures are usually preferred to calculated columns. See these references:
Calculated Columns vs Measures in DAX
Calculated Columns and Measures in DAX
Storage differences between calculated columns and calculated tables
Creating a Dynamic Date Table in Power Query
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI Reporting@Anonymous I would recommend either create new table using UNION function in DAX or append table in Power Query. That is the best use case for you.
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
115 | |
112 | |
105 | |
95 | |
58 |
User | Count |
---|---|
174 | |
147 | |
136 | |
102 | |
82 |