What might make your life easier, is to do your first query and delay, then your second query I think you'll have to write the raw SQL, as I don't think you can pass parameters to power query. By writing the SQL directly you can do something likeselect * from table1 where primarykey= apply_to_each.item()?['primarykey']using the output from this will still trigger an apply to each, so you'll have to reference the output via an expression:body('SQLQuery')?['resultsets'].Table1.DateColumnor if you want to get crafty do your comparison in SQL as welldeclare @datecolumnone nvarchar(max)declare @datecolumntwo nvarchar(max)set @datecolumnone ='apply_to_each.item()?['primarykey']'
set @datecolumntwo=(select datecolumn from table1 where primarykey= apply_to_each.item()?['primarykey'])select case when @datecolumnone=@datecolumntwo then 'Same Value' else 'Different Value' end as DateComparisionOutputyou can then take this SQL output and move your flow along based on the DateComparisionOutput value