Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
SuryaK
Frequent Visitor

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

1 ACCEPTED SOLUTION
Anonymous
Not 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:

vtangjiemsft_0-1666863867520.png

 

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. 

 

View solution in original post

2 REPLIES 2
Anonymous
Not 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:

vtangjiemsft_0-1666863867520.png

 

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. 

 

Thanks @ v-tangjie-msft

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.