Forum Discussion

tina345's avatar
tina345
Icon for Helper II rankHelper II
2 years ago

Slicer based on another Slicer

I have this data set with sales and purchase date.

1st slicer has date_type, what I am trying is based on what user select on date_type, create another slicer with those dates for users to filter data additionally.

 

I have tried different steps and used selected_value DAT to identify what is selected however while applying DAX it doesnt working.

Sales date selection is ok, however if I switch to purchase_date, it still picks sales_date.Any direction/help would be appreciated.

 

 

 

 

 

Data Set 1:

date_type
sales_date
purchase_date

 

Data Set 2:

idsales_datepurchase_dateamount
11/1/20232/1/2023100
21/2/20232/2/2023105
31/3/20232/3/2023110
41/4/20232/4/2023115
51/5/20232/5/2023120
61/6/20232/6/2023125

 

slicer_Date =
     if( SELECTEDVALUE(Sheet1[date_type]) = "purchase_date" , Sheet2[purchase_date] , Sheet2[sales_date] )
   
     // if( SELECTEDVALUE(Sheet1[date_type]) = "purchase_date" , Sheet2[purchase_date] ,
     // if (SELECTEDVALUE(Sheet1[date_type]) = "sales_date" , Sheet2[sales_date]))))
 
 

 

Thanks

2 Replies

  • You can do this using field parameters.

     

    1. Enable preview feature field parameters
    2. create a new field parameter containing your two date columns
    3. copy the auto-created slicer
    4. on the second slicer, select "Show values of selected fields"


    There is a detailed explaination in this video
    https://www.youtube.com/watch?v=2vqVTAfqrfg

     

     

  • Uzi2019's avatar
    Uzi2019
    Icon for Community Champion rankCommunity Champion

    Hi tina345 

    You have created disconnected table. If you want your selection to be dynamic then do field parameter values.

     

    I have taken similar view of your model just ncolumn name is different.

     

    when user select date6 from slicer then date range should be change . I have also shared the table so that you can easily understand.

     

    Now i have selected different date from slicer 

     

     

     

    Please refer below video fr better understanding!

    https://www.youtube.com/watch?v=-nqEv2YXLsU

     

    Note: 
    If you take same value in both slicer it will not show you as you can see in my screenshot

     

    For date range slicer please take table then add parameter value then convert your table into slicer value.

     

    if you directly take parameter value in slicer then will show you like this

     

    so take table visual then add paramter value in it.

     

     then convert your table into slicer visual

     

     

     

    See you will see the desired result.

     

    I hope I answered your question!