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
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
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.