Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Count rows based on a filter/date

Hello, I'm getting lost a bit here. For a specific visual I need to calculate Service Request created in a specific timeframe as well as service request escalated to the design team. This will be us...
  • BA_Pete's avatar
    5 years ago

    Hi Anonymous ,

     

    First, you need to relate your calendar table to your fact table.

    Drag [Date] from calendar to [occurred] - this should apply an ACTIVE relationship.

    Then drag [Date] from calendar to [escalated to design] - this should apply an INACTIVE relationship.

    Both relationships should show as calendar is the ONE side and Service Request Table is the MANY side.

     

    Then set up these measures:

    _requestsOccurred = DISTINCTCOUNT('Service request table'[Service Request ID])
    
    _requestsEscalated =
    CALCULATE(
      DISTINCTCOUNT('Service request table'[Service Request ID]),
      USERELATIONSHIP('Service request table'[escalated to design], Calendar[Date])
    )

     

    Use the Calendar table date/week number as your visual axis.

    You should now be able to use both of these measures in the same visual and view their values within a common timeframe.

     

    Pete

    Pete