Forum Discussion

DMCUK-London-21's avatar
DMCUK-London-21
New Member
4 years ago

Table.ReplaceValue - Refresh Data - Potential Missing Columns

Hi All

 

I hope everybody is safe and well?

 

I have quick question why I am hoping people will be able to answer. 

 

I currently have a ReplaceValue set on a query for a Datasource. The purpose of this is to replace the word of null with 0. Essentially the Datasource will have a list of weeks in columns where this needs to be replaced.

 

Table.ReplaceValue(#"Changed Type",null,0,Replacer.ReplaceValue,{"Week 1", "Week 2", "Week 3", etc})

 

The issue I have got is that if a column is missing on the data source I would get the error:

 

Expression.Error: The column 'Week 69' of the table wasn't found. Details: Week 69.

 

How can I get around this error, if I know that there is the potential to have other columns missing on different data refreshes.

 

Please let me know also if there is a better way to do this?

 

Kind Regards

 

 

 

1 Reply

  • HotChilli's avatar
    HotChilli
    Community Champion

    Looks like you should be unpivotting those week columns.  Should make everything a bit easier.