Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
aJ2
Helper I
Helper I

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.

 

2 ACCEPTED SOLUTIONS
Stachu
Community Champion
Community Champion

try this

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


Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

View solution in original post

v-yulgu-msft
Employee
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

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yulgu-msft
Employee
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

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-yulgu-msft and @Stachu

 

Thank you so much...

 

Both the solutions worked for me

Stachu
Community Champion
Community Champion

try this

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


Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.