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

Power Query - Append if no error

Hello,

 

I have 2 queries, for Primary Model & Comparison Model which i need to Append.

 

The Comparison Model will not always be there, thus its query will have an error when it is not defined.

 

I want to create an Append Query such that it Appends Primary and Comparison Model when both are defined and returns only Primary Model when Comparison is not defined.

 

Kindly help if possible.

Thank you.

1 ACCEPTED SOLUTION
Jimmy801
Community Champion
Community Champion

Hello @Anonymous 

 

in addition to the answer of @edhans you can try if this solution would work out for you. This only worsk if your ComparisonModel gives an error, not only a cell value with an error

Result = try Table.Combine({PrimaryModel, ComparisonModel}) otherwise PrimaryModel


If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

View solution in original post

3 REPLIES 3
Jimmy801
Community Champion
Community Champion

Hello @Anonymous 

 

in addition to the answer of @edhans you can try if this solution would work out for you. This only worsk if your ComparisonModel gives an error, not only a cell value with an error

Result = try Table.Combine({PrimaryModel, ComparisonModel}) otherwise PrimaryModel


If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

This was great advice! I have a large data model with 15+ queries to different Snowflake tables. But my organisation also wanted me to include data from a Google Sheet that many people work in and of course it happens frequently that somebody messes up the sheet and then the query to it and the refresh of my entire report fails. 

What I've done now is to enter a manual table with only the correct column names from the Google Sheet in it and I "try" to append the real data from the Google Sheet to it. Even if the append fails, I'm still left with my original empty table and the query and refresh continue uninterruptedly!

edhans
Super User
Super User

The Comparison query always has to be there. You cannot have queries popping into existence and then vanishing on each refresh. The contents of the Comparison query may change. It may return errors, it may return 0 rows, or valid data.

 

So please define what you mean by "not defined." Read this info to help us with good info. How to get good help fast. Help us help you.

How To Ask A Technical Question If you Really Want An Answer

How to Get Your Question Answered Quickly - Give us a good and concise explanation
How to provide sample data in the Power BI Forum - Provide data in a table format per the link, or share an Excel/CSV file via OneDrive, Dropbox, etc.. Provide expected output using a screenshot of Excel or other image. Do not provide a screenshot of the source data. I cannot paste an image into Power BI tables.



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

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.

Top Solution Authors
Top Kudoed Authors