Forum Discussion

ironboy0418's avatar
ironboy0418
Icon for Helper II rankHelper II
3 years ago
Solved

How to reference slicer from another based on user selection using switch in dax?

Hello, I am trying to reference a date column to a slicer. First, I have created a query table that has this selection/values:

Slicer 1:

The objective is when I selected a value in slicer 1, the selection should update in slicer 2. Here are the example options for Quarterly, Monthly, and Weekly from my date table that I am trying to reference with:

 

Quarterly:

 

 

Monthly:

 

 

Weekly:

 

Here is my dax formula. However, I am not sure how to write for it to be referenced using switch:

RelativePeriodSelection =
VAR SelectYearQuarter = SELECTEDVALUE('Date'[YearQuarter])
VAR SelectYearMonth = SELECTEDVALUE('Date'[YearMonth2])
VAR SelectWeekStart = SELECTEDVALUE('Date'[Start of Week])

VAR DynamicDateValue =
    SWITCH (SELECTEDVALUE(Period[RelativeDate]), "Quarterly", SelectYearQuarter, "Monthly", SelectYearMonth, "Weekly", SelectWeekStart

    )
RETURN
DynamicDateValue
 

 

Result:

 

cc tamerj1