Forum Discussion

aJ2's avatar
aJ2
Icon for Helper I rankHelper I
8 years ago
Solved

Calculating the values for the complete month based on date slicer

Hi.

 

I want to calculate the target number based on the date slicer.

 

For example, the date range selected is 1st May 2018-23rd June 2018, then the output should be 1st May 2018-31st May 2018 + 1st June 2018-30th June 2018).

 

Likewise, if the date range selected is 1st March 2018-10th March 2018, the output should be the target of 1st March 2018-31st March 2018.

 

I have created a measure but it is only considering it for the current month-

 

revenue target = CALCULATE(SUM(data[targettarget]),MONTH('data'[date])=MONTH(TODAY()))

 

So when I change the date range to May, I can still see only the values for June.

 

 

Kindly guide.

 

  • try this

    revenue target:=CALCULATE(SUM(data[targettarget]),PARALLELPERIOD(data[date],0,MONTH))
  • Hi aJ2,

     

    You need a calendar table which is unrelated to data table, generateed by CALENDAR() function. 

     

    revenue target =
    CALCULATE (
        SUM ( data[targettarget] ),
        MONTH ( 'data'[date] ) >= MONTH ( MIN ( calendar[dates] ) )
            && MONTH ( 'data'[date] ) <= MONTH ( MAX ( calendar[dates] ) )
    )
    

    Best regards,

    Yuliana Gu

3 Replies

  • Stachu's avatar
    Stachu
    Icon for Community Champion rankCommunity Champion

    try this

    revenue target:=CALCULATE(SUM(data[targettarget]),PARALLELPERIOD(data[date],0,MONTH))
  • v-yulgu-msft's avatar
    v-yulgu-msft
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi aJ2,

     

    You need a calendar table which is unrelated to data table, generateed by CALENDAR() function. 

     

    revenue target =
    CALCULATE (
        SUM ( data[targettarget] ),
        MONTH ( 'data'[date] ) >= MONTH ( MIN ( calendar[dates] ) )
            && MONTH ( 'data'[date] ) <= MONTH ( MAX ( calendar[dates] ) )
    )
    

    Best regards,

    Yuliana Gu