Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Pulling Value from Another Table based on Two Date Fields

Hi, I have two tables as part of a data model - one called 'pbi TablePriceDiscStaging' and another called 'SalesOrderLineV2Staging'.  These two tables are linked via a field called 'AccountItemUnit....
  • DataZoe's avatar
    6 years ago

    Anonymous 

     

    You could try this measure:

     

    Amount in Pricing Agreement Dates =
    CALCULATE (
        SUM('pbi TablePriceDiscStaging'[Amount]),
        FILTER (
            'pbi TablePriceDiscStaging',
            'pbi TablePriceDiscStaging'[FROMDATE] <= MIN ( SalesOrderLineV2Staging[ORDERCREATIONDATETIME] )
                && 'pbi TablePriceDiscStaging'[TODATE] > MAX ( SalesOrderLineV2Staging[ORDERCREATIONDATETIME] )
        )
    )