Forum Discussion

susan_d_10's avatar
susan_d_10
Frequent Visitor
2 years ago

Grouping the Hours into a visual when using Live Connection

I am using Switch to group the hours that a job was done.   Sample below which returns the values I want, but when I use this measure in say a table visual it only shows values when I include the original Job Date in the visual.   Of course this then overrides my grouping measure.   I am working in Live Connect and cannot change this.

Job Time Bracket =
    var _JobHour =  HOUR(MAX('factUniflowJobDetails'[JobDate]))
    RETURN
    SWITCH (TRUE,
                 _JobHour >= 0 && _JobHour <= 7, "1. Out Of Hours AM",
                 _JobHour > 7 &&  _JobHour <= 12, "2. Morning",
                 _JobHour  > 12 &&  _JobHour <= 17, "3. Afternoon",
                 _JobHour > 17 &&  _JobHour <= 24, "3. Out of Hours PM",
                 "No Time"
              )

2 Replies

  • AllisonKennedy's avatar
    AllisonKennedy
    Community Champion

    susan_d_10 

     

    With live connection you're limited with what you can do. Only way I can think to get close to what you want is to create separate measures for each group, but I'd need more info on what end result you want displayed (what other fields) to be more helpful here. 

     

    A simple COUNTROWS function is what I have in mind, for example:

     

    1 Out of Hours AM Count =
    COUNTROWS(FILTER ( 'factUniflowJobDetails' ,

    VAR _JobHour = HOUR( 'factUniflowJobDetails'[JobDate] ) 

    RETURN

    _JobHour >= 0 && _JobHour <= 7 
    )
    )

     

    And repeat this pattern for the other measures.

    Otherwise, this grouping is something that should be done in the source dataset. 

    • susan_d_10's avatar
      susan_d_10
      Frequent Visitor

      Thank you, your response indicates what I thought.   I will try the individual measures otherwise go back to the devlopers.