Merge muliple columns from resultset dynamically

I have a datasubset DS containing properties X, Y and others. I am trying to take the property X and Y dynamically and do the merge ( property names are passed dynamically ).

Below script didnt work because apply is returning a single array with all the values for X and Y. Is there any other way to do it?

local!propertyName_txts: {
    "X",
    "Y"
  },
  merge(
    apply(
      fn!property(
        local!DS_ds.data,
        _
      ),
      local!propertyName_txts
    )
  )

 

  Discussion posts and replies are publicly visible