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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
NAV_81
Frequent Visitor

DAX - Count with Multiple Filters, Causing Memory Issues.

I am pretty new to DAX and am trying to do a count on some invoicing costs issues, there are some filters that need to apply to show what a true cost issue is. I have got the below to work the way I wanted but I am getting memory issues and the visuals will only work when a store is selected on my report. Any ideas on how to optimize this would be greatly appreciated.

 

Cost Issue Count = CALCULATE(COUNTROWS(Invoices),FILTER(Invoices,[Cost Issue]<0),FILTER(Invoices,[Est GP %]<0.20),FILTER(Invoices,[CurrentSellInc]>0),FILTER(Invoices,[Invoice Status]<>"Killed"),FILTER('POS Item Details',[ModuleItem]="F"),FILTER('POS Item Details',[PillarName]<>"Prescriptions"),FILTER(Invoices,[CurrentSellLocationCode]<>"CLR"))
2 REPLIES 2
Mohammad_Refaei
Solution Specialist
Solution Specialist

Can you try this?

Cost Issue Count =
CALCULATE (
    COUNTROWS ( Invoices ),
    FILTER (
        Invoices,
        [Cost Issue] < 0
            && [Est GP %] < 0.20
            && [CurrentSellInc] > 0
            && [CurrentSellLocationCode] <> "CLR"
            && [Invoice Status] <> "Killed"
    ),
    FILTER (
        'POS Item Details',
        [ModuleItem] = "F"
            && [PillarName] <> "Prescriptions"
    )
)
Samarth_18
Community Champion
Community Champion

Hi @NAV_81 

Its bit difficult to say if this issue is due to measure only since memory issue can be related to your data model as well. If you could share your precised data model so we might help you more specifically. 

But in the mean time can you try below code?

Cost Issue Count =
CALCULATE (
    COUNTROWS ( Invoices ),
    FILTER (
        Invoices,
        [Cost Issue] < 0
            && [Est GP %] < 0.20
            && [CurrentSellInc] > 0
            && [Invoice Status] <> "Killed"
            && [CurrentSellLocationCode] <> "CLR"
    ),
    FILTER (
        'POS Item Details',
        [ModuleItem] = "F"
            && [PillarName] <> "Prescriptions"
    )
)

 

Thank you,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

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

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors