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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
Helper V
Helper V

A table cannot be dynamic. Only measures can. 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

Top Kudoed Authors