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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
tina345
Helper II
Helper II

Create a date slicer (slide) , based on what is selected on another Date_Type Slicer

Hi All,

   I have a data set with Sales and Delivery Date.I have added Screen Shot with data set  as well .My requirement is to have a date_type slicer(slicer_1) with sales and delivery date, based on what user select , I need to have another date_slider (Slicer_2).

  

    I created selected_value measure based on what is selected on date_type slicer , and was planning to create slicer_2 based on that measure, however it looks like I can't link that slicer with measure.

 

   Date_Type Slicer : Sales_Date and Delivery_Date

   Date Slider          : Another slicer based on what is selected above from Date_Type slicer

  m_Selected_Value = if(   SELECTEDVALUE(Sheet[DATA_FILTER])= "Sales_Date" , "Sales_Date", "Delivery_Date")

tina345_0-1713804246166.png

Data Set:

Product_IDRegionSales_DateDelivery_Date
100East1/1/20231/5/2023
100West2/3/20232/10/2023
200East3/2/20233/5/2025
300East3/15/20233/18/2023
400North4/1/20234/15/2023
500South5/1/20235/15/2023

 

  Thanks

  

1 ACCEPTED SOLUTION
Alex87
Solution Supplier
Solution Supplier

Hello,

First, you need a Date Table marked as Date and a slicer table with the two options (Sales Date/ Delivery Date = slicer 1)

Second, you need a DAX flag that you apply to the slicer 2 (coming from the Date table - I chose Month & Year but it can be changed to something else like day date etc)

Alex87_0-1713811677759.png

Alex87_2-1713811763050.png

The formula for the Flag is = 

Flag =
VAR __CurrentSelection = SELECTEDVALUE(Slicer[Slicer], "Sales Date")
VAR __Boolean =
IF(
    __CurrentSelection = "Sales Date",
    NOT(ISBLANK(
        CALCULATE(
            MAX('Data'[Sales_Date]),
            ALL('Dates'),
            'Data'[Sales_Date] IN VALUES('Dates'[Date])
        )
    )),
    NOT(ISBLANK(
        CALCULATE(
            MAX('Data'[Delivery_Date]),
            ALL('Dates'),
            'Data'[Delivery_Date]  IN VALUES('Dates'[Date])
        )
    ))
)
VAR __Result = IF(__Boolean, 1, 0)

RETURN
__Result
 
Is this asnwering your question? If so, please mark it as a solution
 
Best regards,
Alex Badiu

 

 

View solution in original post

1 REPLY 1
Alex87
Solution Supplier
Solution Supplier

Hello,

First, you need a Date Table marked as Date and a slicer table with the two options (Sales Date/ Delivery Date = slicer 1)

Second, you need a DAX flag that you apply to the slicer 2 (coming from the Date table - I chose Month & Year but it can be changed to something else like day date etc)

Alex87_0-1713811677759.png

Alex87_2-1713811763050.png

The formula for the Flag is = 

Flag =
VAR __CurrentSelection = SELECTEDVALUE(Slicer[Slicer], "Sales Date")
VAR __Boolean =
IF(
    __CurrentSelection = "Sales Date",
    NOT(ISBLANK(
        CALCULATE(
            MAX('Data'[Sales_Date]),
            ALL('Dates'),
            'Data'[Sales_Date] IN VALUES('Dates'[Date])
        )
    )),
    NOT(ISBLANK(
        CALCULATE(
            MAX('Data'[Delivery_Date]),
            ALL('Dates'),
            'Data'[Delivery_Date]  IN VALUES('Dates'[Date])
        )
    ))
)
VAR __Result = IF(__Boolean, 1, 0)

RETURN
__Result
 
Is this asnwering your question? If so, please mark it as a solution
 
Best regards,
Alex Badiu

 

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.