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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.