Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Dear friend,
How to use the if loop to add a new column like this info.
I want a new column looking for other columns but in the row is not null if null will look for a higher row looping like below but i don't want write long till -60
if [Column5]<> null
then [Column5]
else if #"Replaced Value" [Column5]{[Index]-1} <> null
then #"Replaced Value" [Column5]{[Index]-1}
else if #"Replaced Value" [Column5]{[Index]-2} <> null
then #"Replaced Value" [Column5]{[Index]-2}
else if #"Replaced Value" [Column5]{[Index]-3} <> null
then #"Replaced Value" [Column5]{[Index]-3}
Thank you
@Anonymous , You can use List.Select or each
new column example
let
_ind = [Index]
_Table = Table.Select(#"Replaced Value" , each [Index] <_ind)
_list = List.Select(#"Replaced Value"[Column5] , each _ <> null)
_value = if List.IsEmpty(_list) then _list{0} else null
in
_value
List.Reverse can be used in case the it in revrese order
User | Count |
---|---|
98 | |
75 | |
74 | |
49 | |
26 |