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
Anonymous
Not applicable

Append tables that include columns created by DAX using Power Query

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.

DateCategoryDetails
01/01/2020Ablah blah
01/02/2020Byada yada

 

New data looks like this.

DateNew CategoryNew SubcategoryDetails

01/03/2020

CEblah blah

01/03/2020

DFyada yada

01/04/2020

DGlalalalala

 

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

DateNew CategoryNew SubcategoryDetails
01/01/2020(recoded to) C(recoded to) Fblah blah
01/02/2020(recoded to) C(recoded to) Gyada yada

01/03/2020

CEblah blah

01/03/2020

DFyada yada

01/04/2020

DGlalalalala

 

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!

1 ACCEPTED SOLUTION
edhans
Super User
Super User

@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



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

3 REPLIES 3
dax
Community Support
Community Support

Hi  @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

edhans
Super User
Super User

@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



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
parry2k
Super User
Super User

@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.

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.