Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

If Col.X equals n find value in Col.Y of corresponding row

I have a series of workbooks that I've called using

 

let
    Source = Folder.Files("C:\Users\MichaelDaugherty\Desktop\M_Daugherty\Pay\PayPeriods"),
    AddColumn = Table.AddColumn(Source, "Custom", each Excel.Workbook(File.Contents([Folder Path]&[Name]))),
    ExpandedCustom = Table.ExpandTableColumn(#"AddColumn", "Custom", {"Name", "Data"}, {"Custom.Name", "Custom.Data"}),
in
    ExpandedCustom

 

and now I have a column [Column.Data] that contains a table on each row. Each table contains the same general information but often extra rows describing differnt methods of pay. 

 Hours
Regular Pay40
Overtime Pay 5
Sunday Differential 8

 

 Hours
Regular Pay32
Holiday Pay 8
Overtime Pay 5
Sunday Differential 8

 

How would I (can I?) iterate over each table, find the value for overtime pay, and add it to a new column. I've only ever used basic search queries on tables that were all formatted the same so I could call it by column and row but with the row number being variable I'm stumped. 

 

The below example does not work, but just gives me a new column with  "FALSE" for each row. Any advise would be appreciated. 

 

let
    Source = Folder.Files("C:\Users\MichaelDaugherty\Desktop\M_Daugherty\Pay\PayPeriods"),
    AddColumn = Table.AddColumn(Source, "Custom", each Excel.Workbook(File.Contents([Folder Path]&[Name]))),
    ExpandedCustom = Table.ExpandTableColumn(#"AddColumn", "Custom", {"Name", "Data"}, {"Custom.Name", "Custom.Data"}),
    Overtime = Table.AddColumn(ExpandedCustom, "Overtime", each [Custom.Data][Column2] = "Overtime Pay")
in
    Overtime

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous 

 

Modify your last line a little bit, there are 2 tables concept here...

 

= Table.AddColumn(ExpandedCustom, "Overtime", each Table.SelectRows( [Custom.Data], each [Column1] = "Overtime Pay")[Column2]{0}?)

 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Anonymous 

 

Modify your last line a little bit, there are 2 tables concept here...

 

= Table.AddColumn(ExpandedCustom, "Overtime", each Table.SelectRows( [Custom.Data], each [Column1] = "Overtime Pay")[Column2]{0}?)

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors