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
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
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.