Forum Discussion

samHil's avatar
samHil
Frequent Visitor
5 years ago

Set Store open/close status when selecting multiple Dates

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"

9 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    How are we to solve this puzzle without knowing how you produce the statuses for different time periods? Any idea?

    • samHil's avatar
      samHil
      Frequent Visitor

      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 __Status__Check = if([GS]=0 && [GS Prev]<>0,"Close","Open")
      Return
      __Status__Check

       

      • Mohammad_Refaei's avatar
        Mohammad_Refaei
        Solution Specialist

        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"
            )