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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
eliasayyy
Memorable Member
Memorable Member

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
Memorable Member
Memorable Member

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
Memorable Member
Memorable Member

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.