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
pnem
Frequent Visitor

Exclude items from DAX query

EVALUATE
SELECTCOLUMNS (
    ADDCOLUMNS (
        SUMMARIZECOLUMNS (
            ROLLUPADDISSUBTOTAL ( 'DimItem'[Item Type], "h0" ),
            FILTER (
                VALUES ( DimItem[Season Code] ),
                OR (
                    ( @DimItemSeasonCode = "All" ),
                    PATHCONTAINS ( @DimItemSeasonCode, DimItem[Season Code] )
                )
            )
        ),
        "ParameterLevel", IF ( [h0], 0, 1 )
    ),
    "ParameterCaption", SWITCH ( [ParameterLevel], 1, "" & 'DimItem'[Item Type], "Blank()" ),
    "ParameterValue", "" & 'DimItem'[Item Type],
    "ParameterLevel", [ParameterLevel],
    "'DimItem'[Item Type]", 'DimItem'[Item Type]
)
ORDER BY
    'DimItem'[Item Type],
    [ParameterLevel]

I want to exclude item "Bag" from the list DimItemType

EVALUATE
SELECTCOLUMNS (
    ADDCOLUMNS (
        SUMMARIZECOLUMNS (
            ROLLUPADDISSUBTOTAL ( 
                FILTER('DimItem', 'DimItem'[Item Type] <> "BAG"), "h0" 
            ),
            FILTER (
                'DimItem',
                OR (
                    ( @DimItemSeasonCode = "All" ),
                    PATHCONTAINS ( @DimItemSeasonCode, 'DimItem'[Season Code] )
                )
            )
        ),
        "ParameterLevel", IF ( [h0], 0, 1 )
    ),
    "ParameterCaption", SWITCH ( [ParameterLevel], 1, "" & 'DimItem'[Item Type], "Blank()" ),
    "ParameterValue", "" & 'DimItem'[Item Type],
    "ParameterLevel", [ParameterLevel],
    "'DimItem'[Item Type]", 'DimItem'[Item Type]
)
ORDER BY
    'DimItem'[Item Type],
    [ParameterLevel]

Tried to add in filter to <> "Bag"  but I still get BAG inside the parameter list and in final result set.

Any advice?
Thanks!



5 REPLIES 5
BeaBF
Super User
Super User

@pnem Hi!
It looks like you added the filter on the 'DimItem' table after the ROLLUPADDISSUBTOTAL function, which is causing the "BAG" item to still appear in the final result set. To exclude "BAG" from the list of DimItemType, you need to apply the filter before the ROLLUPADDISSUBTOTAL function. Here's an updated version of the query that should work:

EVALUATE
SELECTCOLUMNS (
ADDCOLUMNS (
SUMMARIZECOLUMNS (
ROLLUPADDISSUBTOTAL (
FILTER('DimItem', 'DimItem'[Item Type] <> "BAG"),
"h0"
),
FILTER (
FILTER('DimItem', 'DimItem'[Item Type] <> "BAG"),
OR (
( @DimItemSeasonCode = "All" ),
PATHCONTAINS ( @DimItemSeasonCode, 'DimItem'[Season Code] )
)
)
),
"ParameterLevel", IF ( [h0], 0, 1 )
),
"ParameterCaption", SWITCH ( [ParameterLevel], 1, "" & 'DimItem'[Item Type], "Blank()" ),
"ParameterValue", "" & 'DimItem'[Item Type],
"ParameterLevel", [ParameterLevel],
"'DimItem'[Item Type]", 'DimItem'[Item Type]
)
ORDER BY
'DimItem'[Item Type],
[ParameterLevel]

BBF

pnem
Frequent Visitor

Thanks for the help, but I still get the error message - 

Screenshot 2023-03-27 142442.png

 



Advice? 🙂

@pnem 

ROLLUPGROUP (
FILTER (
FILTER('DimItem', 'DimItem'[Item Type] <> "BAG"),
OR (
( @DimItemSeasonCode = "All" ),
PATHCONTAINS ( @DimItemSeasonCode, 'DimItem'[Season Code] )
)
)
)


BBF

pnem
Frequent Visitor

pnem_0-1679924860875.png

Still have the issue, any other solution? 😢

@pnem 

 

EVALUATE
SELECTCOLUMNS (
ADDCOLUMNS (
SUMMARIZECOLUMNS (
ROLLUPADDISSUBTOTAL ( 'DimItem'[Item Type], "h0" ),
FILTER (
VALUES ( DimItem[Season Code] ),
OR (
( @DimItemSeasonCode = "All" ),
PATHCONTAINS ( @DimItemSeasonCode, DimItem[Season Code] )
)
)
),
"ParameterLevel", IF ( [h0], 0, 1 )
),
"ParameterCaption", SWITCH ( [ParameterLevel], 1, "" & 'DimItem'[Item Type], "Blank()" ),
"ParameterValue", "" & 'DimItem'[Item Type],
"ParameterLevel", [ParameterLevel],
"'DimItem'[Item Type]", 'DimItem'[Item Type]
),
-- add filter condition here to exclude "Bag"
DimItem[Item Type] <> "Bag"
)
ORDER BY
'DimItem'[Item Type],
[ParameterLevel]

 

BBF

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.