cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Route217
Post Prodigy
Post Prodigy

Calculate last 12 months from Selected Month from Slicer

Hi Experts

 

See attached Sample File

I am trying to dynamically calculate the last 12 months from the selcted month on the slicer. 

 

Sample Data
https://www.dropbox.com/s/va9t5wrkxxjjpls/v1.3.pbix?dl=0 

2 ACCEPTED SOLUTIONS
niteshtrehan89
Helper II
Helper II

Hi

Can you please try the below dax function

 

Sales =

VAR CurrentDate = SELECTEDVALUE(‘Date'[End of Month Date],MAX(‘Date'[End of Month Date]))

VAR PreviousDate = CurrentDate – 365

RETURN

CALCULATE(

    SUM(Table[SalesAmount]),

    FILTER(

        Table,

        Table[End of Month Date] >= PreviousDate && Table[End of Month Date] <= CurrentDate

    )

)

View solution in original post

Hi Nitesh. The measure is not working, can you kinldy test uing the Sample file.

View solution in original post

2 REPLIES 2
niteshtrehan89
Helper II
Helper II

Hi

Can you please try the below dax function

 

Sales =

VAR CurrentDate = SELECTEDVALUE(‘Date'[End of Month Date],MAX(‘Date'[End of Month Date]))

VAR PreviousDate = CurrentDate – 365

RETURN

CALCULATE(

    SUM(Table[SalesAmount]),

    FILTER(

        Table,

        Table[End of Month Date] >= PreviousDate && Table[End of Month Date] <= CurrentDate

    )

)

View solution in original post

Hi Nitesh. The measure is not working, can you kinldy test uing the Sample file.

View solution in original post

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are You Ready?

Test your skills now with the Cloud Skills Challenge.

Top Solution Authors