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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Darrell
Frequent Visitor

Remaining Stores Not Delivered CALCULATE FILTER

Thanks for viewing.  What I thought would be simple has me stumped.

 

PBI File: PBI Deliveries File 

 

I have a simple task - find out what stores were NOT delivered depending on the user's Week Ending choice.  It seems to work choosing 1 week, but when I choose multiple weeks, using the slicer, the number should decrease and not increase.

 

The delivered column contains a whole number of how many deliveries per week were made (0-3).  I need to focus solely on those stores that didn't have a delivery over the weeks - stores that 'delivered' data adds up to 0.

 

3 Columns of Data

Darrell_0-1628168324590.png

 

 The "visual" filter I have in place to show only those stores not delivered:

 

Darrell_3-1628168704400.png

 

When I choose 1 week, it works fine.  The total is 208 in this example:

 

count_not_delivered = 
    CALCULATE(
        COUNTA(deliver_data[store_num]), 
        FILTER('deliver_data', 'deliver_data'[delivered] = 0)
    )

 

Darrell_1-1628168380676.png

 

 

When I choose all 3 dates, it should only be 13, but instead, it adds up to 643. 

 

Darrell_2-1628168474299.png

 

I understand why - it's counting all stores with a 0 in the 'delivered' column for all 3 weeks individually.  I need it to somehow SUM all 3 weeks and filter by that and I'm not finding anything online to help.

 

I feel like this should work, but of course, it doesn't.

 

count_not_delivered = 
    CALCULATE(
        COUNTA(deliver_data[store_num]), 
        FILTER('deliver_data', SUM('deliver_data'[delivered]) = 0)
    )

 

Any help would be appreciated!

 

1 ACCEPTED SOLUTION
edhans
Community Champion
Community Champion

This will do it @Darrell 

New Measure = 
COUNTX(
    FILTER(
        ADDCOLUMNS(
            SUMMARIZE(
                'deliver_data',
                'deliver_data'[store_num]
            ),
            "@Total",
                CALCULATE(
                    SUM( 'deliver_data'[delivered] )
                )
        ),
        [@Total] = 0
    ),
    'deliver_data'[store_num]
)

FilteredData.gif



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

3 REPLIES 3
edhans
Community Champion
Community Champion

This will do it @Darrell 

New Measure = 
COUNTX(
    FILTER(
        ADDCOLUMNS(
            SUMMARIZE(
                'deliver_data',
                'deliver_data'[store_num]
            ),
            "@Total",
                CALCULATE(
                    SUM( 'deliver_data'[delivered] )
                )
        ),
        [@Total] = 0
    ),
    'deliver_data'[store_num]
)

FilteredData.gif



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Thanks!  I'll take some time and work through your solution.  I appreciate it!

edhans
Community Champion
Community Champion

Glad to help @Darrell - what ADDCOLUMNS(SUMMARIZE()) is doing is building a mini-table that is grouped the way you were describing the desired results, the it FILTER()'s it, then COUNTX will count the instances. Any questions, let me know. 

I used DAX Studio to build the mini-table so I could see what it was. Here is how the table looks with no filtering by a slicer. Once in Power BI and a slicer affects it, it changes.

edhans_0-1628177630905.png

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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