Skip to main content
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
arkiboys2
Contributor

dataflow - if there is a row present

hello,

in the dataflow gen2, there are several steps from navigation of the source all the way to pivot column.

After the pivot, the step is to rename column. But the flow fails on this rename step because if there is no data then the step fails as the column does not exists

 

Any suggestions ?

thank you

2 ACCEPTED SOLUTIONS
frithjof_v
Honored Contributor

I would add a dummy row with the necessary columns before that step, so that the step doesn't fail, and then I would filter away the dummy row afterwards. 

View solution in original post

I created a HelperRow which only has columns and no rows.

Then after the pivot step, I appended this helper row.

It seems fine now

 

thank you

View solution in original post

9 REPLIES 9
lbendlin
Esteemed Contributor III

use try ... otherwise ...  to decide what to produce in this scenario.

you mean to have try catch inside dataflow gen2? is this the only way?

how is this possible?

thanks

frithjof_v
Honored Contributor

You could add a dummy row.

 

However, do you want the dataflow to succeed if there is no data?

yes to succeed if there is no row. thanks
frithjof_v
Honored Contributor

I would add a dummy row with the necessary columns before that step, so that the step doesn't fail, and then I would filter away the dummy row afterwards. 

I created a HelperRow which only has columns and no rows.

Then after the pivot step, I appended this helper row.

It seems fine now

 

thank you

Thankyou

frithjof_v
Honored Contributor

If you want to do the try ... otherwise ... logic instead of adding a dummy row, there is a description in the link. I can actually recommend to go through all the parts of this series if you have the time:

 

https://bengribaudo.com/blog/2020/01/15/4883/power-query-m-primer-part-15-error-handling

 

I've done most of the parts, but I skipped the last ones as I didn't feel they were so relevant for my use cases at the time.

 

I don't think there are so many users who have gone through this series, but it gives a great theoretical description (and also many practical examples!) of the Power Query M language. If you have the time. I had already worked 3 years with Power BI/Power Query before I did this series.

Anonymous
Not applicable

Hi @arkiboys2 

 

If you use Table.RenameColumns to rename columns, a simple solution is to add MissingField.Ignore at the end. MissingField.Type - PowerQuery M | Microsoft Learn

vjingzhanmsft_0-1730946216874.png

vjingzhanmsft_1-1730946616923.png

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

Helpful resources

Announcements
Users online (27)