Forum Discussion

rolf1994's avatar
rolf1994
Helper II
9 years ago
Solved

Calculate value between two dates

Hi, i have the following tables in my data model (using directquery). I want to calculate the value in the ValueTable between the StartDate and EndDate. ValueTable: Date Value 25-2-2017 1 ...
  • v-ljerr-msft's avatar
    v-ljerr-msft
    9 years ago

    Hi rolf1994,

     

    You should be able to use the formula below to create a measure in this scenario, then show the measure on the Table/Matrix visual with PeriodTable[StartDate] and PeriodTable[EndDate] column. :smileyhappy:

     

    Measure = 
    CALCULATE (
        SUM ( ValueTable[Value] ),
        FILTER (
            ValueTable,
            ValueTable[Date] >= MIN( PeriodTable[StartDate] )
                && ValueTable[Date] <= MAX ( PeriodTable[EndDate] )
        )
    )
    

     

    Regards