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
Anonymous
Not applicable

How to include a filter in a topN dax function?

I want to include a filter in my dax function but not sure how?

 

see below my new table formula (works fine)

 

 

Top5Products = 
TOPN(
    5,
    SUMMARIZE(
        'DimProduct',
        'DimProduct'[ProductFlag],
        'DimProduct'[ProductID],
        'DimProduct'[ProductKey],
        'DimProduct'[ProductName],
        "Products",
        SUM('FctSales'[TotalVolume])
    ),
    [Providers]
)

 

I want to put in a filter that does something like this:

 

FILTER ( DimProduct, 'DimProduct'[ProductFlag] <> "False" )

 

 in other words dont include any products where the product flag is False 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Why dont you add this filter before the summarize

Top5Products =

TOPN(

    5,

    Filter(SUMMARIZE(

        'DimProduct',

        'DimProduct'[ProductFlag],

        'DimProduct'[ProductID],

        'DimProduct'[ProductKey],

        'DimProduct'[ProductName],

        "Products",

        SUM('FctSales'[TotalVolume])

    ),'DimProduct'[ProductFlag]<>"False"),

    [Providers]

)

View solution in original post

3 REPLIES 3
tackytechtom
Super User
Super User

Hi @Anonymous 

 

Does it work with this one?

Top5Products = 
TOPN(
    5,
    SUMMARIZE(
        FILTER ( 'DimProduct', 'DimProduct'[ProductFlag] <> "False" )
        'DimProduct'[ProductFlag],
        'DimProduct'[ProductID],
        'DimProduct'[ProductKey],
        'DimProduct'[ProductName],
        "Products",
        SUM('FctSales'[TotalVolume])
    ),
    [Providers]
)

 

Let me know if this works for you 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Anonymous
Not applicable

Why dont you add this filter before the summarize

Top5Products =

TOPN(

    5,

    Filter(SUMMARIZE(

        'DimProduct',

        'DimProduct'[ProductFlag],

        'DimProduct'[ProductID],

        'DimProduct'[ProductKey],

        'DimProduct'[ProductName],

        "Products",

        SUM('FctSales'[TotalVolume])

    ),'DimProduct'[ProductFlag]<>"False"),

    [Providers]

)

Anonymous
Not applicable

Perfect! Thank you james

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.