Forum Discussion
slicer
When I select Aug 17 in the filter than data of only Jun-17, July-17 and Aug-17 should be shown in the slicer graph
- Anonymous3 years ago
Hi SuryaK ,
According to your description, you want to select a certain value in a slicer and then return the value of the day of the previous 3 months in the slicer. For this requirement, which we cannot achieve in one slicer, we need to use two tables and create two slicers.
Here is my test data: "Table"
Table = CALENDAR(DATE( 2022,1,1) ,DATE(2022,3,1))Then we need to create a second date table based on the date column of this Table, and make sure that the date column of this new date table needs to contain the first three months of the table's dates.
Table 2 = var _max_date = MAX('Table'[Date]) var _min_date = MIN('Table'[Date]) var _first_date = EDATE(_min_date , -2) return CALENDAR(_first_date , _max_date)Then, we create a measure.
Measure = var _slice = SELECTEDVALUE( 'Table'[Date]) var _t = {EDATE(_slice,-1),EDATE(_slice,-2),_slice} return IF(SELECTEDVALUE('Table 2'[Date]) in _t ,1,0)Then we put 'Table'[Date] in slicer 1, then 'Table2'[Date] in slicer 2, and then we put our metric in slicer 2's " Filter on this visual" and then configure it as follows:
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- AnonymousNot applicable
Hi SuryaK ,
According to your description, you want to select a certain value in a slicer and then return the value of the day of the previous 3 months in the slicer. For this requirement, which we cannot achieve in one slicer, we need to use two tables and create two slicers.
Here is my test data: "Table"
Table = CALENDAR(DATE( 2022,1,1) ,DATE(2022,3,1))Then we need to create a second date table based on the date column of this Table, and make sure that the date column of this new date table needs to contain the first three months of the table's dates.
Table 2 = var _max_date = MAX('Table'[Date]) var _min_date = MIN('Table'[Date]) var _first_date = EDATE(_min_date , -2) return CALENDAR(_first_date , _max_date)Then, we create a measure.
Measure = var _slice = SELECTEDVALUE( 'Table'[Date]) var _t = {EDATE(_slice,-1),EDATE(_slice,-2),_slice} return IF(SELECTEDVALUE('Table 2'[Date]) in _t ,1,0)Then we put 'Table'[Date] in slicer 1, then 'Table2'[Date] in slicer 2, and then we put our metric in slicer 2's " Filter on this visual" and then configure it as follows:
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- SuryaKFrequent Visitor
Thanks @ v-tangjie-msft