Forum Discussion
ChelseaCL
2 years agoFrequent Visitor
Custom Column to Lookup Multiple Fields in Other Table and Return Match within Date Range
Hi guys, thanks for your help. I have a record of transactions: people accessing software and the date on which they accessed it. On a separate table, I have "contracts." This table includes th...
- 2 years ago
Hi, ChelseaCL
a quick conversion from gpt
go to add a custom column then paste this code below. Please adjust the Previous step name first. Or it will show error.
= Table.AddColumn(#"PreviousStepName", "Contract Index", each let _startdate = List.First( Table.Column( Table.SelectRows(Contracts, each [Company] = [Company] and [Software] = [Software] ), "Start Date" ) ), _enddate = List.First( Table.Column( Table.SelectRows(Contracts, each [Company] = [Company] and [Software] = [Software] ), "End Date" ) ), _indates = [Accessed] >= _startdate and [Accessed] <= _enddate, _indexnumber = List.First( Table.Column( Table.SelectRows(Contracts, each [Company] = [Company] and [Software] = [Software] ), "Index Number" ) ) in if _indates then _indexnumber else null )
rubayatyasmin
2 years agoCommunity Champion
Hi, ChelseaCL
a quick conversion from gpt
go to add a custom column then paste this code below. Please adjust the Previous step name first. Or it will show error.
= Table.AddColumn(#"PreviousStepName", "Contract Index", each
let
_startdate = List.First(
Table.Column(
Table.SelectRows(Contracts,
each [Company] = [Company] and [Software] = [Software]
), "Start Date"
)
),
_enddate = List.First(
Table.Column(
Table.SelectRows(Contracts,
each [Company] = [Company] and [Software] = [Software]
), "End Date"
)
),
_indates = [Accessed] >= _startdate and [Accessed] <= _enddate,
_indexnumber = List.First(
Table.Column(
Table.SelectRows(Contracts,
each [Company] = [Company] and [Software] = [Software]
), "Index Number"
)
)
in
if _indates then _indexnumber else null
)