Discount on a sale

I have a Discounts table, with the date, catalog id, and discount fields; the discount must be applied until the date indicated in the table. In the sales table, I need that when I select the catalog id, look in the discount table if it has a discount and place it in the DISCOUNT field. I used this expression but it doesn’t work for me:

if (TODAY () <= LOOKUP ([CATALOG ID] = [_ THISROW]. [CATALOG ID], Discounts, DISCOUNT ID, DATE), LOOKUP (MAXROW (“Discounts”, “DATE”, [CATALOG ID] = [_ THISROW ]. [CATALOG ID]), “Discounts”, “DISCOUNT ID”, “DISCOUNT”), 0)

THANKS FOR THE SUPPORT

You’re using LOOKUP() wrong.

1 Like

You’re right Steve, thank you very much.

1 Like