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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Super User
Super User

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
Super User
Super User

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!

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.