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
eliasayyy
Super User
Super User

create a dynamic selection slicer that affects date slicer

hello everyone i have a normal calendar table and another table called selection table

annonymous1999_0-1687630352500.png

 

annonymous1999_1-1687630373643.png

 

i made a measure

Filter Latest Month For SP = 
SWITCH(
    SELECTEDVALUE('Period Select'[ID]),
    1, IF( AND(MAX('Calendar'[Week Number]) = WEEKNUM(TODAY(),2),MAX('Calendar'[Year Number]) = YEAR(TODAY())),1,0),
    2, IF( AND(MAX('Calendar'[Month Number]) = MONTH(TODAY()),MAX('Calendar'[Year Number]) = YEAR(TODAY())),1,0),
    3, IF( AND(MAX('Calendar'[Quarter Number]) = QUARTER(TODAY()),MAX('Calendar'[Year Number]) = YEAR(TODAY())),1,0),
    4, IF(MAX('Calendar'[Year Number]) = YEAR(TODAY()) , 1 , 0),
    5, IF(MAX('Calendar'[Year Number]) = YEAR(TODAY()) -1 , 1 , 0),
    6,1
)

 

 

i added this measure to my 2 slicers , year slicer and timeline slicer , and set it to is 1

annonymous1999_2-1687630467813.png



when i select the main slicer selection it works 

Examples:

annonymous1999_3-1687630507889.pngannonymous1999_4-1687630531743.png

annonymous1999_5-1687630550505.pngannonymous1999_6-1687630571870.png



but it doesnt affect my measures or does a filter to my visuals

annonymous1999_7-1687630628281.png

it should say from june 19 to june 23 but it shows me my whole data



 

 

 

1 ACCEPTED SOLUTION
eliasayyy
Super User
Super User

ok i just created a new table

Test Dynamic Table = 
UNION(
    SELECTCOLUMNS(
        FILTER('Calendar', 'Calendar'[Date] >= TODAY() - WEEKDAY(TODAY(), 2) + 1 && 'Calendar'[Date] <= TODAY()),
        "Date", 'Calendar'[Date],
        "Type", "Current Week",
        "Order", 1
    ),
    SELECTCOLUMNS(
        FILTER('Calendar', 'Calendar'[Date] >= DATE(YEAR(TODAY()), MONTH(TODAY()), 1) && 'Calendar'[Date] <= TODAY()),
        "Date", 'Calendar'[Date],
        "Type", "Current Month",
        "Order", 2
    ),
    SELECTCOLUMNS(
        FILTER('Calendar', 'Calendar'[Date] >= DATE(YEAR(TODAY()), INT((MONTH(TODAY()) - 1) / 3) * 3 + 1, 1) && 'Calendar'[Date] <= TODAY()),
        "Date", 'Calendar'[Date],
        "Type", "Current Quarter",
        "Order", 3
    ),
    SELECTCOLUMNS(
        FILTER('Calendar', 'Calendar'[Date] >= DATE(YEAR(TODAY()), 1, 1) && 'Calendar'[Date] <= TODAY()),
        "Date", 'Calendar'[Date],
        "Type", "Current Year",
        "Order", 4
    ),
    SELECTCOLUMNS(
        FILTER('Calendar', 'Calendar'[Date] >= DATE(YEAR(TODAY()) - 1, 1, 1) && 'Calendar'[Date] <= DATE(YEAR(TODAY()) - 1, 12, 31)),
        "Date", 'Calendar'[Date],
        "Type", "Last Year",
        "Order", 5
    ),
    SELECTCOLUMNS(
        FILTER('Calendar', 'Calendar'[Date] >= MIN('Calendar'[Date]) && 'Calendar'[Date] <= MAX('Calendar'[Date])),
        "Date", 'Calendar'[Date],
        "Type", "Custom",
        "Order", 6
    )
)


made a relationship between my new table and calendar table from "Date" Column and szet it to both and it worked

View solution in original post

1 REPLY 1
eliasayyy
Super User
Super User

ok i just created a new table

Test Dynamic Table = 
UNION(
    SELECTCOLUMNS(
        FILTER('Calendar', 'Calendar'[Date] >= TODAY() - WEEKDAY(TODAY(), 2) + 1 && 'Calendar'[Date] <= TODAY()),
        "Date", 'Calendar'[Date],
        "Type", "Current Week",
        "Order", 1
    ),
    SELECTCOLUMNS(
        FILTER('Calendar', 'Calendar'[Date] >= DATE(YEAR(TODAY()), MONTH(TODAY()), 1) && 'Calendar'[Date] <= TODAY()),
        "Date", 'Calendar'[Date],
        "Type", "Current Month",
        "Order", 2
    ),
    SELECTCOLUMNS(
        FILTER('Calendar', 'Calendar'[Date] >= DATE(YEAR(TODAY()), INT((MONTH(TODAY()) - 1) / 3) * 3 + 1, 1) && 'Calendar'[Date] <= TODAY()),
        "Date", 'Calendar'[Date],
        "Type", "Current Quarter",
        "Order", 3
    ),
    SELECTCOLUMNS(
        FILTER('Calendar', 'Calendar'[Date] >= DATE(YEAR(TODAY()), 1, 1) && 'Calendar'[Date] <= TODAY()),
        "Date", 'Calendar'[Date],
        "Type", "Current Year",
        "Order", 4
    ),
    SELECTCOLUMNS(
        FILTER('Calendar', 'Calendar'[Date] >= DATE(YEAR(TODAY()) - 1, 1, 1) && 'Calendar'[Date] <= DATE(YEAR(TODAY()) - 1, 12, 31)),
        "Date", 'Calendar'[Date],
        "Type", "Last Year",
        "Order", 5
    ),
    SELECTCOLUMNS(
        FILTER('Calendar', 'Calendar'[Date] >= MIN('Calendar'[Date]) && 'Calendar'[Date] <= MAX('Calendar'[Date])),
        "Date", 'Calendar'[Date],
        "Type", "Custom",
        "Order", 6
    )
)


made a relationship between my new table and calendar table from "Date" Column and szet it to both and it worked

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors