Forum Discussion
Advanced Slicer filtering months
Hello Folks ! Please help me with the following doubt !
I have a slicer which filters Months. I want the output on barchart such as :- If I select June, Bar chart should show me the Month - March, April, May, June, July, Aug, Sept, December, June Previous Year and December Previous Year.
Thank you in advance.
- Anonymous5 years ago
Hi Anonymous ,
You can create a seperate table with month name, then create the specified measure like
Measure = IF ( ISFILTERED ( MonthName[Month] ), SWITCH ( SELECTEDVALUE ( MonthName[Month] ), "June", CALCULATE ( SUM ( 'Table'[Value] ), FILTER ( 'Table', ( [Date] < DATE ( YEAR ( TODAY () ), 10, 1 ) && [Date] >= DATE ( YEAR ( TODAY () ), 3, 1 ) ) || ( [Date] >= DATE ( YEAR ( TODAY () ), 12, 1 ) && [Date] <= DATE ( YEAR ( TODAY () ), 12, 31 ) ) || ( [Date] >= DATE ( YEAR ( TODAY () ) - 1, 6, 1 ) && [Date] <= DATE ( YEAR ( TODAY () ) - 1, 6, 30 ) ) || ( [Date] >= DATE ( YEAR ( TODAY () ) - 1, 12, 1 ) && [Date] <= DATE ( YEAR ( TODAY () ) - 1, 12, 31 ) ) ) ) ), SUM ( 'Table'[Value] ) )Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- amitchandakSuper User
Anonymous , You need to create the bar visual on an independent date table. based on that you can have more dates on the other selected visual
explained similar stuff here - Need of an Independent Date Table:https://www.youtube.com/watch?v=44fGGmg9fHI
- AnonymousNot applicable
Hi Anonymous ,
You can create a seperate table with month name, then create the specified measure like
Measure = IF ( ISFILTERED ( MonthName[Month] ), SWITCH ( SELECTEDVALUE ( MonthName[Month] ), "June", CALCULATE ( SUM ( 'Table'[Value] ), FILTER ( 'Table', ( [Date] < DATE ( YEAR ( TODAY () ), 10, 1 ) && [Date] >= DATE ( YEAR ( TODAY () ), 3, 1 ) ) || ( [Date] >= DATE ( YEAR ( TODAY () ), 12, 1 ) && [Date] <= DATE ( YEAR ( TODAY () ), 12, 31 ) ) || ( [Date] >= DATE ( YEAR ( TODAY () ) - 1, 6, 1 ) && [Date] <= DATE ( YEAR ( TODAY () ) - 1, 6, 30 ) ) || ( [Date] >= DATE ( YEAR ( TODAY () ) - 1, 12, 1 ) && [Date] <= DATE ( YEAR ( TODAY () ) - 1, 12, 31 ) ) ) ) ), SUM ( 'Table'[Value] ) )Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.