0
votes

eg: If I select Feb 2019 from the date slicer, I want the total loan amount from March 2019 to Feb 2020, start date and end date is given
eg: I want in the similar way: I want the output similarly

From the given DAX. for particular month of March, I am getting the proper o/p but I want for entire previous 12 months as I select the date from the slicer:


    abc =
    CALCULATE(
        SUM( Pledge[pledge_amount] ),
        FILTER(
            Pledge,
             ( Pledge[ft_start_date] >= MIN( 'Calendar'[Date] ) )
                && Pledge[ft_start_date] <= DATE( 2020, 05, 31 )
                && Pledge[ft_end_date] > DATE( 2020, 03, 31 )
                && COUNTROWS(
                    FILTER(
                        'Age Group',
                        'Age Group'[object] = "pledge"
                            && 'Age Group'[units] = "month"
                            && [Age Months] >= 'Age Group'[min]
                            && [Age Months] <= 'Age Group'[max]
                    )
                )
        )
    )

1

1 Answers

0
votes

We call the desired result moving annual total wich can be donne by using DATESINPERIOD function.

Use this code :

abc =
CALCULATE(
 SUM(Pledge[pledge_amount]),
 DATESINPERIOD ('Calendar'[Date],LASTDATE('Calendar'[Date]),-1,YEAR)
)