Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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.
Solved! Go to Solution.
@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
)
)
)
@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
)
)
)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
47 | |
24 | |
20 | |
15 | |
13 |
User | Count |
---|---|
51 | |
42 | |
39 | |
19 | |
19 |