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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
sudhakar111
Helper IV
Helper IV

previous year end of the month

Hi ,

 

We have a date slicer which is based on a calendar table. For Example if i enter date 09/01/2017 and till date which is 09/18/2017,I

need to show the measures for previous year end of the month,so it should be sum(measure) for 09/01/2016 and 09/30/2016. It should show for the entire month and not date to date comparison.

 

Best Regards,

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@sudhakar111,

 

You may refer to the following DAX.

Measure =
VAR d =
    MAX ( 'Calendar'[Date] )
RETURN
    CALCULATE (
        SUM ( Table1[Column1] ),
        Table1[Date]
            >= DATE ( YEAR ( d ) - 1, MONTH ( d ), 1 )
            && Table1[Date]
                < DATE ( YEAR ( d ) - 1, MONTH ( d ) + 1, 1 )
    )
Community Support Team _ Sam Zha
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

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@sudhakar111,

 

You may refer to the following DAX.

Measure =
VAR d =
    MAX ( 'Calendar'[Date] )
RETURN
    CALCULATE (
        SUM ( Table1[Column1] ),
        Table1[Date]
            >= DATE ( YEAR ( d ) - 1, MONTH ( d ), 1 )
            && Table1[Date]
                < DATE ( YEAR ( d ) - 1, MONTH ( d ) + 1, 1 )
    )
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks a lot. I tried the formula with minor changes and it worked perfectly.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.