cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

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

Accepted Solutions
Highlighted
Super User II
Super User II

Re: Append tables that include columns created by DAX using Power Query

@reesetou 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
Highlighted
Super User IV
Super User IV

Re: Append tables that include columns created by DAX using Power Query

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






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.





Highlighted
Super User II
Super User II

Re: Append tables that include columns created by DAX using Power Query

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

Highlighted
Community Support
Community Support

Re: Append tables that include columns created by DAX using Power Query

Hi  @reesetou , 

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

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

July 2020 Community Highlights

July 2020 Community Highlights

Learn about the exciting things that happened in July.

Featured Data Story of The Month

Featured Data Story of The Month

All Data Stories Gallery contributions are reviewed for each month. We select a contribution and feature the community member the following month.

Power BI Dev Camp - Developing with .NET Core

Power BI Dev Camp - Developing with .NET Core

Learn how to develop custom web applications for Power BI using .NET Core 3.1 and .NET 5.

Power BI Desktop August 2020 Update

Power BI Desktop August 2020 Update

We have great updates this month! Click the link for the video with more info.

Top Solution Authors
Top Kudoed Authors