Forum Discussion

HEW's avatar
HEW
Helper III
4 years ago
Solved

Lookup value per date

Hi.

 

I am trying to create a table, where I show the cost price for the first day of the month. We have a table with all cost prices, pls. see below:

 

Price table   
Article no.Date startDate end Price 
101.01.201830.11.2021            12,00
101.12.202131.12.9999            15,00
201.01.201831.12.9999            22,00
301.01.201831.01.2022            25,00
301.02.202231.12.9999            26,00

 

And I would like to have a visual like below:

Visual:     
 nov-21dec-21jan-22feb-22% Dev
Article 1              12,00                15,00            15,00           15,0025%
Article 2              22,00                22,00            22,00           22,000%
Article 3              25,00                25,00            25,00           26,004%

 

I do have a date table as well and have tried a lot of different measures, but no one is working.

 

Any suggestions?

 

Thanks a lot in advance.

Helen

  • HEW , you can use the measure below:

    PricePerStartOfMonth =
    VAR c_article = SELECTEDVALUE ( 'Table'[Article no.] )
    VAR c_date = SELECTEDVALUE ( Dates[StartOfMonth] )
    RETURN
        CALCULATE (
            MAX ( 'Table'[ Price ] ),
            'Table'[Article no.] = c_article,
            c_date >= 'Table'[Date start],
            c_date <= 'Table'[Date end]
        )
    

    If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.

    I am a Ukrainian living in Ukraine. Please, help us to survive! Please, Ask your government to react!
    Here are official ways you can support us financially (accounts with multiple currencies):
    https://bank.gov.ua/ua/about/support-the-armed-forces

    USD:
    BENEFICIARY: National Bank of Ukraine
    BENEFICIARY BIC: NBUA UA UX
    BENEFICIARY ADDRESS: 9 Instytutska St, Kyiv, 01601, Ukraine
    ACCOUNT NUMBER: 400807238
    BENEFICIARY BANK NAME: JP MORGAN CHASE BANK, New York
    BENEFICIARY BANK BIC: CHASUS33
    ABA 0210 0002 1
    BENEFICIARY BANK ADDRESS: 383 Madison Avenue, New York, NY 10017, USA
    PURPOSE OF PAYMENT: for crediting account 47330992708

    Accounts details for other currencies (EUR|GBP|CHF|AUD|CAD|PLN) can be found here: https://bank.gov.ua/ua/about/support-the-armed-forces

2 Replies

  • ERD's avatar
    ERD
    Community Champion

    HEW , you can use the measure below:

    PricePerStartOfMonth =
    VAR c_article = SELECTEDVALUE ( 'Table'[Article no.] )
    VAR c_date = SELECTEDVALUE ( Dates[StartOfMonth] )
    RETURN
        CALCULATE (
            MAX ( 'Table'[ Price ] ),
            'Table'[Article no.] = c_article,
            c_date >= 'Table'[Date start],
            c_date <= 'Table'[Date end]
        )
    

    If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.

    I am a Ukrainian living in Ukraine. Please, help us to survive! Please, Ask your government to react!
    Here are official ways you can support us financially (accounts with multiple currencies):
    https://bank.gov.ua/ua/about/support-the-armed-forces

    USD:
    BENEFICIARY: National Bank of Ukraine
    BENEFICIARY BIC: NBUA UA UX
    BENEFICIARY ADDRESS: 9 Instytutska St, Kyiv, 01601, Ukraine
    ACCOUNT NUMBER: 400807238
    BENEFICIARY BANK NAME: JP MORGAN CHASE BANK, New York
    BENEFICIARY BANK BIC: CHASUS33
    ABA 0210 0002 1
    BENEFICIARY BANK ADDRESS: 383 Madison Avenue, New York, NY 10017, USA
    PURPOSE OF PAYMENT: for crediting account 47330992708

    Accounts details for other currencies (EUR|GBP|CHF|AUD|CAD|PLN) can be found here: https://bank.gov.ua/ua/about/support-the-armed-forces

    • HEW's avatar
      HEW
      Helper III

      It works perfectly!

       

      Thanks a lot.

      Helen