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

Count of Closed Stores by Sales with Exceptions

I need to get a count of closed stores where closed is defined as a store with less than $100 in sales for any given day. The tricky part is that certain stores always close on Sunday and these stores need to be excluded from the count, but only on Sundays. If they close on a Tuesday, they need to be included in the count.

Here's what I have so far. It seems to give me the correct counts by day, but the total is incorrect. Any help would be appreciated.

TempClosure =
CALCULATE (
    COUNTROWS (
        FILTER (
            SUMMARIZE (
                Sales,
                Sales[Date],
                Sales[Store],
                "ClosedFlag", IF ( SUM ( Sales[SalesNet] ) < 100, 1, 0 ),
                "SpecialStoreFlag", IF ( Sales[RestaurantKey] IN { 001, 002 }, 1, 0 ),
                "SpecialDayFlag", IF ( SELECTEDVALUE ( 'DATE'[DayNameInt] ) = 1, 1, 0 )
            ),
            [ClosedFlag] = 1
                && ( [SpecialStoreFlag] = 0
                && [SpecialDayFlag] = 0 )
                || ( [SpecialStoreFlag] = 1
                && [SpecialDayFlag] = 0 )
                || ( [SpecialStoreFlag] = 0
                && [SpecialDayFlag] = 1 )
        )
    )
)


In the above code I feel that the first three rows of the filter expression should suffice, but then I lose all sundays or all days for the special stores.

DaHolla_0-1625775963507.png

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@DaHolla , Try a measure like

 

TempClosure =
CALCULATE (
Sumx (
SUMMARIZE (
Sales,
Sales[Date],
sales([Day of Week]) , // Create a new column weekday([Date],2)
Sales[Store],
"Sales", SUM ( Sales[SalesNet] )
),
Switch(true() , ([Sales] <100 && [Day of Week] <> 7) , 1, 0
)
)
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@DaHolla , Try a measure like

 

TempClosure =
CALCULATE (
Sumx (
SUMMARIZE (
Sales,
Sales[Date],
sales([Day of Week]) , // Create a new column weekday([Date],2)
Sales[Store],
"Sales", SUM ( Sales[SalesNet] )
),
Switch(true() , ([Sales] <100 && [Day of Week] <> 7) , 1, 0
)
)
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.