Forum Discussion

Matthew77's avatar
Matthew77
Frequent Visitor
5 years ago
Solved

Measure to return value between two dates (start date and end date)

Hi,

 

I want to create a measure that returns the number of units between 2 dates. I have went through so many different types of codes I may be over complicating this for myself. I have a table with the following type of data :

 

Contract IDUnitsStart DateEnd Date
1231101/01/2000 30/06/2018
1231001/07/2018 01/04/2021
1231202/04/2021 

 

I want the measure to return the number of units. I have a chart with year as the axis but for some reason it doesnt seem to want to plot correctly to show how the number of unit changes over a given period of time. 

 

For example a chart to show when the number of units changed from 10 to 12 etc between two dates. I am able to produce the below manually by using a chart but I need it as a measure to add to another chart:

 

 

 

Thanks

  • Matthew77's avatar
    Matthew77
    5 years ago

    Hi Amitchadak,

     

    It would be like the below. I just wish to have a measure that will show how the number of units has changed over the years:

     

    THIS CODE WORKED:

     

    Units =
    CALCULATE(
    VALUES(Contract[Units]),
    FILTER(
    Contract,
    Contract[EffectiveDate] <= MAX('Date'[Date])
    && Contract[EndDate] >= MIN('Date'[Date])
     
    but to no avail. 

5 Replies