Forum Discussion

smpa01's avatar
smpa01
Icon for Community Champion rankCommunity Champion
6 years ago

Does DAX have anything equivalent to R's cbind?

Hello Experts,

Does DAX have anything that can replicate excatly what R's cbind does.

 

For example,

I have two tables as below

 

TestTest2
AA
AA

 

and

alpha

1
2

 

cbind in R can combine these two columns to create a new table as below

TestTest2alpha
AA1
BA2

 

let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSAeJYHTgrFgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Test = _t, Test2 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Test", type text}}),
#"Run R script" = R.Execute("# 'dataset' holds the input data for this script#(lf)df1<- data.frame(alpha=c(1:2))#(lf)df2<- cbind(dataset,df1)#(lf)df2",[dataset=#"Changed Type"]),
df2 = #"Run R script"{[Name="df2"]}[Value]
in
df2

Can this be replicated using anything in DAX by any chance?

Thank you in advance .

 

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hello-

     

      This is probably going to be best done in PowerQuery.  My suggestion would be to merge the columns and then expand "alpha" to combine these 2 tables.

     

    Jared

    • smpa01's avatar
      smpa01
      Icon for Community Champion rankCommunity Champion

      Anonymous  thanks for the reply. I know how it can be done in M. Just wondering if DAX has this capacity?

  • stevedep's avatar
    stevedep
    Icon for Memorable Member rankMemorable Member

    Hi,

    I wrote an M function that does this. Please take a look here

     

    Kind regards,

     

    Steve.