Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I have store status set as open/close for each day using calculated measure to check if sales=0 "Close" or Sales >0 "Open".I checked it each day it is showing correctly. The problem am facing is that when i select week number from the calender Slicer the result is different , it shows open, What i am looking for is that if a stoe is closed for a day then the week status should show "Close". The same happen when i select multiple date which has "open" and "Close" status. The result is always "Open"
Eample:
Mon-open
Tue-open
Wed -open
Thu-Open
Fri-open
Sat-open
Sun-open
Weekly status is "Open"(Correct)
Mon-open
Tue-open
Wed -close
Thu-Open
Fri-close
Sat-close
Sun-open
Weekly status is "Open"(Wrong)-- I want the result to show "close"
How are we to solve this puzzle without knowing how you produce the statuses for different time periods? Any idea?
HIi @Anonymous ,
Sorry i didnt get your question. I am getting the store status using a measure which checks the sales for a day and when i select the day in calander slicer it shows correctly ,if store has no sales it shows as "Close" but when i check for multiple days it is not showing "Close" which is my requirement( if a store has zero sales in a any of the selected day the store status should be set to "close"). I hope i made it clare.
This is the measuere i use
[Open/Close] =
var HasNoClosedStatus =
CALCULATE(
ISEMPTY( T ), // T is your fact table with statuses
KEEPFILTERS( T[Status] = "close" )
)
var Result =
if( HasNoClosedStatus,
"open",
"closed"
)
return
Result
@Anonymous,
Status is determined by a measure.
Here is the detail
There are 3 Measures
There are 3 tables
1, Calender_Lookup -- where the date is taken for slicer
2,Location_Lookup -- store is taken for the table
3,Sales -- the sales for each day is taken
Sales table is linked to Calender_lookup with date
Sales table is liked to location with store name
I understand that you want to flag the week as closed if it it closed in any day.
Then you probably need to write a measure like:
Weekly Status =
VAR DailyStaus =
ADDCOLUMNS (
SUMMARIZE ( 'Calendar', 'Calendar'[Date] ),
"Status", [Open/Close]
)
RETURN
IF (
CALCULATE ( COUNTROWS ( DailyStatus ), [Status] = 0 ) >= 1,
"Close",
"Open"
)
Hi @Mohammad_Refaei ,
I think this is the logic am looking for but the code is having error --"The value for 'Status' cannot be determined. Either the column doesn't exist, or there is no current row for this column."
Or like this:
[Open/Close] =
var HasNoClosedStatus =
ISEMPTY(
// Then, see if the result
// is empty. If it is, all
// days have sales and the
// return status should be
// "open". Otherwise, "close".
FILTER(
// First try to find dates
// for which the fact table
// is empty in the current
// context, meaning no sales.
DISTINCT( T[Date] ),
CALCULATE( ISEMPTY( T ) )
)
)
var Result =
if( HasNoClosedStatus,
"open",
"closed"
)
return
Result
It will help if you share your model table structure and measures
Hi @Mohammad_Refaei ,
Here is the detail
There are 3 Measures
There are 3 tables
1, Calender_Lookup -- where the date is taken for slicer
2,Location_Lookup -- store is taken for the table
3,Sales -- the sales for each day is taken
Sales table is linked to Calender_lookup with date
Sales table is liked to location with store name
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
12 | |
9 | |
7 | |
6 | |
6 |
User | Count |
---|---|
20 | |
11 | |
10 | |
9 | |
7 |