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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Woody4265
Regular Visitor

Dynamic Slicers

I'm new to power bi and it capabilities, If I expalin my dilema then hopefullysomeone will have the answer.

 

I have a disconected table thatretrieves the last 3 year from a mydataI.E.2023,2022&2021 this is placedin a slicer

 

Code = 

Year Slicer = 
var _Year = CALCULATETABLE(
                     VALUES('Quotes View'[ActionYear]),
                     FILTER('Quotes View','Quotes View'[ActionYear] >= Year(TODAY())-2)
)
Var Results = _Year
RETURN
Results

 

This produces the slicer with 3 values. I also have an aditional dynamic slicer that uses:

 

Period Selection = 
var TodaysDate = Today()
var YearStart = CALCULATE(STARTOFYEAR('Quotes View'[ActionedDate]),Year('Quotes View'[ActionedDate]) = Year(TodaysDate))
var QuarterStart = CALCULATE(STARTOFQUARTER('Quotes View'[ActionedDate]),Year('Quotes View'[ActionedDate]) = Year(Year(TodaysDate)) ,QUARTER('Quotes View'[ActionedDate]) = QUARTER(TodaysDate))
var MonthStart = CALCULATE(STARTOFMONTH('Quotes View'[ActionedDate]),Year('Quotes View'[ActionedDate]) = Year(Year(TodaysDate)),Month('Quotes View'[ActionedDate]) = Month(TodaysDate))
var WeekStart = TodaysDate - WEEKDAY(TodaysDate,2)+1
Var Results =
    UNION (
        ADDCOLUMNS(
            CALENDAR(YearStart,TodaysDate),
            "Selection","YTD",
            "SelectionId",1
        ),
        ADDCOLUMNS(
            CALENDAR(QuarterStart,TodaysDate),
            "Selection","QTD",
            "SelectionId",2
        ),
        ADDCOLUMNS(
            CALENDAR(MonthStart,TodaysDate),
            "Selection","MTD",
            "SelectionId",3
        ),
        ADDCOLUMNS(
            CALENDAR(WeekStart,TodaysDate),
            "Selection","WTD",
            "SelectionId",4
        ),
        ADDCOLUMNS(
            CALENDAR(TODAY(),TodaysDate),
            "Selection","Today",
            "SelectionId",5
        )
    )
    RETURN
    Results

 

This return aslicer with the following Option YTD,QTD,MTD,WTD  Today, the issue I have is the above code is only for the current year, I tried numorouse variations to input the value from the year slicer but none work. I want to be able to select a year an the other slicer displays the data for the period seleted for the year selected.

Any assistance would be greatly appreciated.

1 REPLY 1
lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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