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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Peter_Smit
New Member

Dynamic Filter: Use a SWITCH() inside a FILTER() function

Hi,

 

i have a table (with 1 column) which has 2 values:

 

NAV: Turnover Time => = #table({"Time Table"},{{"Current Year"},{"Other Period"}})

 

I have created a slicer to select one of the two values.
Based on the SELECTEDVALUE I would like to do some specific filtering:

 

TABLE: Turnover =
    SUMMARIZE(
        FILTER(
            FACT_CUSTOMER_INVOICE_BI,
            SWITCH(
                SELECTEDVALUE('NAV: Turnover Time'[Time Table]),
                "Current Year", YEAR(FACT_CUSTOMER_INVOICE_BI[INVOICE_DATE]) = YEAR(NOW()) // filters for the current year
            )
        ),
        FACT_CUSTOMER_INVOICE_BI[InvoiceFilter],
        DIM_COMPANY_BI[CompanyFilter],
        DIM_CUSTOMER_BI[CUSTOMER_NAME],
        DIM_PROJECT_BI[ProjectFilter],
        FACT_CUSTOMER_INVOICE_BI[INVOICE_DATE].[Year]
    )
 
Result is an empty table while it should present al rows with invoice year is current year.
 
For some reason the result of SELECTEDVALUE() is empty ? while if I check this value as a card (visual) it returns "Current Year"..
 
What am I doning wrong?
 
Kind regards,
 
Peter
1 REPLY 1
Rupak_bi
Super User
Super User

A table cannot be dynamic. Only measures can. 



Regards
Rupak
FOLLOW ME : https://www.linkedin.com/in/rupaksar/

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.