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

Solved Solved
0 2 112
1 ACCEPTED SOLUTION

Youโ€™re right Steve, thank you very much.

View solution in original post

2 REPLIES 2

Steve
Platinum 4
Platinum 4

Youโ€™re using LOOKUP() wrong.

Youโ€™re right Steve, thank you very much.

Top Labels in this Space