Forum Discussion

Jers19's avatar
Jers19
New Member
2 years ago
Solved

Calculated column

Hello,

I have two tables (without relation)

  • table of sales with two columns
    • ID
    • date of sales
  • table of prices with four columns
    • ID
    • validity start date
    • expiry date
    • price

I'd like to add a calculated column in the "sales" table with the price that was valid.

I try with "filter" but I have a result only when the sales date is egal to the validity start date ๐Ÿ˜ž

Thank you for your help

  • Hi Jers19 

    please try

    Price =
    MAXX (
    FILTER (
    Price,
    Price[ID] = Sales[ID]
    && Price[Validity Start Date] <= Sales[Date of Sales]
    && Price[Expiry Date] >= Sales[Date of Sales]
    ),
    Price[Price]
    )

2 Replies

  • tamerj1's avatar
    tamerj1
    Community Champion

    Hi Jers19 

    please try

    Price =
    MAXX (
    FILTER (
    Price,
    Price[ID] = Sales[ID]
    && Price[Validity Start Date] <= Sales[Date of Sales]
    && Price[Expiry Date] >= Sales[Date of Sales]
    ),
    Price[Price]
    )