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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
mora11
Helper I
Helper I

SWITCH over SUMMARIZECOLUMNS based on parameter value

Hello, I have created parameter and based on that I would like to calculate dynamic table using SUMMARIZECOLUMNS function. Is that possible at all? Below you can find my DAX idea using SWITCH and IF however it does not work. I need a table as a result of SWITCH / IF statement.

 

EVALUATE
SWITCH (
    TRUE (),
    @Selected_Values = 0, SUMMARIZECOLUMNS ( 'Test Table'[Column] ),
    SUMMARIZECOLUMNS (
        'Test Table'[Column],
        KEEPFILTERS (
            FILTER (
                ALL ( 'Sources'[Source] ),
                PATHCONTAINS ( @Source, 'Sources'[Source] )
            )
        ),
        "Calculation", COUNTROWS ( 'Test Table' )
    )
)

 

And with IF:

EVALUATE
IF (
    @Selected_Values = 0,
    SUMMARIZECOLUMNS ( 'Test Table'[Column] ),
    SUMMARIZECOLUMNS (
        'Test Table'[Column],
        KEEPFILTERS (
            FILTER (
                ALL ( 'Sources'[Source] ),
                PATHCONTAINS ( @Source, 'Sources'[Source] )
            )
        ),
        "Calculation", COUNTROWS ( 'Test Table' )
    )
)

 

Thanks

2 REPLIES 2
amustafa
Solution Sage
Solution Sage

EVALUATE
IF (
@Selected_Values = 0,
SUMMARIZECOLUMNS ( 'Test Table'[Column] ),
SUMMARIZECOLUMNS (
'Test Table'[Column],
KEEPFILTERS (
FILTER (
ALL ( 'Sources'[Source] ),
PATHCONTAINS ( @Source, 'Sources'[Source] )
)
),
"Calculation", COUNTROWS ( 'Test Table' )
)
)





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Unfortunately this is the same I have pasted. To be clear on this, I need a table as a result of SWITCH / IF statement. Thanks

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.