Forum Discussion
Power Query - Change Type from a range os columns by position
- 7 years ago
The function is also very simple, as it takes just one parameter (a table) as it's input. So you would adjust your query to this:
let Source = Table.Combine({#"fUsage-Peak (REF)", #"fUsage_Off-Peak (REF)", #"fCIP (REF)", #"fTotal Cost (REF)", #"fExcedente Energia Reativa P (REF)", #"fExcedente Energia Reativa FP (REF)", #"fDemand Contracted Off-Peak (VERDE) (REF)", #"fDemand Registered Peak (Actual Null) (REF)", #"fDemand Contracted Peak (VERDE) (REF)", #"fDemand Registered Off Peak (Actual Null) (REF)", #"fDemand Registered Peak (Dem Peak) (REF)", #"fDemand Registered Off Peak (Dem Peak) (REF)", #"fDemanda Contracted Peak (AZUL) (REF)", #"fDemanda Contracted Off Peak (AZUL) (REF)", #"fReactive Demand Peak (REF)", #"fReactive Demand Off Peak (REF)"}), ApplyFunction = FunctionName(Source)
in ApplyFunctionWhere "FunctionName" is the name of the query that holds the function code that you have copied.
Please see attached file.
Unfortunally, I still don´t get it how to use the code. Look, my table so far have the following columns. The columns 1 to 6 always will be in that order. However, from column 7 to final the number of columns can change depending of data range I´ll use.
I would like to set the type from column 7 until the end to "Decimal type". I´m trying to use the code that you´ve sent to me, but I´m still having problem with the first part (red circle on image written "Table").
My code it´s simple because this table it´s an append of others. This is the code.
let
Source = Table.Combine({#"fUsage-Peak (REF)", #"fUsage_Off-Peak (REF)", #"fCIP (REF)", #"fTotal Cost (REF)", #"fExcedente Energia Reativa P (REF)", #"fExcedente Energia Reativa FP (REF)", #"fDemand Contracted Off-Peak (VERDE) (REF)", #"fDemand Registered Peak (Actual Null) (REF)", #"fDemand Contracted Peak (VERDE) (REF)", #"fDemand Registered Off Peak (Actual Null) (REF)", #"fDemand Registered Peak (Dem Peak) (REF)", #"fDemand Registered Off Peak (Dem Peak) (REF)", #"fDemanda Contracted Peak (AZUL) (REF)", #"fDemanda Contracted Off Peak (AZUL) (REF)", #"fReactive Demand Peak (REF)", #"fReactive Demand Off Peak (REF)"})
in
Source
The function is also very simple, as it takes just one parameter (a table) as it's input. So you would adjust your query to this:
let
Source = Table.Combine({#"fUsage-Peak (REF)", #"fUsage_Off-Peak (REF)", #"fCIP (REF)", #"fTotal Cost (REF)", #"fExcedente Energia Reativa P (REF)", #"fExcedente Energia Reativa FP (REF)", #"fDemand Contracted Off-Peak (VERDE) (REF)", #"fDemand Registered Peak (Actual Null) (REF)", #"fDemand Contracted Peak (VERDE) (REF)", #"fDemand Registered Off Peak (Actual Null) (REF)", #"fDemand Registered Peak (Dem Peak) (REF)", #"fDemand Registered Off Peak (Dem Peak) (REF)", #"fDemanda Contracted Peak (AZUL) (REF)", #"fDemanda Contracted Off Peak (AZUL) (REF)", #"fReactive Demand Peak (REF)", #"fReactive Demand Off Peak (REF)"}),
ApplyFunction = FunctionName(Source)
in
ApplyFunction
Where "FunctionName" is the name of the query that holds the function code that you have copied.
Please see attached file.
- Anonymous7 years agoNot applicable
It worked!
Thank you so much for the help!