2

I have a table as below. Only the first column "Ticket No" is constant. For the other columns, depending on the data source i can have multiple columns of a similar nature as the screenshot below (in the screenshot there are only 2 columns but there can be more such columns depending on data source)

What i need is for each dynamic column that appears based on the data source apart from the 1st column, to check if the value in each row is having a value or if its null. If it is having a value, then to replace with 1. If its null then to replace with 0

Current Table

Current Table

Expected Outcome

enter image description here

1 Answer 1

3

You can try this in powerquery to apply a transform to each column except the first

let  Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
Columns = List.RemoveFirstN(Table.ColumnNames(Source),1),
Transform = List.Transform(Columns, (x)=>{x, each if _=null then 0 else 1, type number}),
#"Fix" = Table.TransformColumns(Source, Transform)
in #"Fix"

enter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

I have one more modification. In the above, once the 1'sand 0's are populated, i need a new column that will add the values in the dynamic columns. Would you know how to create this ?
Add column .. custom column ... with =List.Sum(List.RemoveFirstN(Record.FieldValues(_),1))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.