Forum Discussion
Custom column If statement to pickup above row value?
- 7 years ago
Hi,
This M code works
let Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content], #"Changed Type" = Table.TransformColumnTypes(Source,{{"Coluxn1", type text}, {"Column2", type any}, {"Column3", type any}, {"Column4", type any}, {"Column5", type any}, {"Column6", type any}, {"Column7", type any}, {"Column8", type any}, {"Manual TAG", Int64.Type}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each if Text.Start([Coluxn1],5)="HdDte" then [Column6] else null), #"Filled Down" = Table.FillDown(#"Added Custom",{"Custom"}), #"Added Custom1" = Table.AddColumn(#"Filled Down", "Custom.1", each [Manual TAG]=[Custom]), #"Removed Columns" = Table.RemoveColumns(#"Added Custom1",{"Custom.1"}) in #"Removed Columns"Hope this helps.
- 7 years ago
Hi Anonymous
You may use 'Fill down' feature with your condition column.
Regards,
Cherie
Hi,
In the Else portion, you want to pick up the value from the previous cell of the same column (in which you are writing that formula). Seems like a tough one. Can you anyways, share some data and also show the expected result. Would you be OK with a DAX solution?
- Anonymous7 years agoNot applicable
Thank you for the response,
Here is screenshot
https://1drv.ms/u/s!Am-JUC7GnsuUtQncEobEaQpKzCmM
and sample in excel file
https://1drv.ms/x/s!Am-JUC7GnsuUtQhNQPqszL8u_cKb
Please let me know if it is possible to achive this using Power BI editor or DAX solution.
parry2k Custom column = Get value from other column
else
Get Same column above value!
Expected last columnThank you
Vans
- Ashish_Mathur7 years ago
Super User
Hi,
This M code works
let Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content], #"Changed Type" = Table.TransformColumnTypes(Source,{{"Coluxn1", type text}, {"Column2", type any}, {"Column3", type any}, {"Column4", type any}, {"Column5", type any}, {"Column6", type any}, {"Column7", type any}, {"Column8", type any}, {"Manual TAG", Int64.Type}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each if Text.Start([Coluxn1],5)="HdDte" then [Column6] else null), #"Filled Down" = Table.FillDown(#"Added Custom",{"Custom"}), #"Added Custom1" = Table.AddColumn(#"Filled Down", "Custom.1", each [Manual TAG]=[Custom]), #"Removed Columns" = Table.RemoveColumns(#"Added Custom1",{"Custom.1"}) in #"Removed Columns"Hope this helps.