Forum Discussion
Show previous month values based on slic
- 3 years ago
Hi Anonymous ,
According to your description, it's because in the formula you provided, havn't take the Date slicer into consideration. Here's my solution.
Order table:
Date table:
Create two measures.
CurrentMonthRevenue = CALCULATE ( SUM ( 'Order'[Revenue] ), FILTER ( 'Order', MONTH ( 'Order'[Date] ) = IF ( ISFILTERED ( 'Date'[Month] ), SELECTEDVALUE ( 'Date'[Month] ), MONTH ( TODAY () ) ) ) )PreviousMonthRevenue = VAR current_month = IF ( ISFILTERED ( 'Date'[Month] ), SELECTEDVALUE ( 'Date'[Month] ), MONTH ( TODAY () ) ) RETURN CALCULATE ( SUM ( 'Order'[Revenue] ), FILTER ( 'Order', MONTH ( 'Order'[Date] ) = current_month - 1 ) )Result:
If there isn't month been selected in the slicer, it will return the current month and corresponding previous month.If other month is selected in the slicer, it will return the selected month and corresponding previous month.
I attach my sample below for your reference.
Best Regards,
Community Support Team _ kalyjIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
No, I want to INCLUDE the slicer filtering in my measure. Based on the chosen months in the slicer the revenue for the current and previous months needs to be calculated.
you can use relative date in slicer and select last 1 calender months... then you will by default prior month revenue when ever you can open that report,, if you want current month means select this month in same slicer....