Forum Discussion

qmahieu11's avatar
qmahieu11
Frequent Visitor
5 years ago
Solved

How to Group By a calculated measure?

I have created 3 measures linked to Id's. 
I'd like to group by one of this measure and having the count of Id's for each value of the measure.

Eg :  The table show Id, A calculated measure Connected member , a calculated measure engaged and a calculated measure Eng Rate

code for one of the calculated measure:
```
Engaged Member = 

  var Lastmonth = [DateForSecondSlicer]
  var eom = EOMONTH([DateForSecondSlicer],0)+1
  var VideoSessionTable = SELECTCOLUMNS(
                                        FILTER(Videos,
                                                     Videos[Date] >= Lastmonth &&  Videos[Date] < eom &&
                                                     Videos[TotalSecondsWatched] >= 180), "WorkspaceId", Videos[d])
return
CALCULATE(COUNT(Users[UserOrganisation Id]),
                    FILTER(Users,
                                    AND(
                                              OR(AND(Users[Departed Date] < eom , Users[Departed Date] >= Lastmonth),
                                                     ISBLANK(Users[Departed Date]))
                                            ,Users[UserOrganisation Id] IN VideoSessionTable)
                       ))
```

The Desired Output would be to group by engagement rate and have the count of organisation Id's:


Any idea how to get there?
Thanks for your help

2 Replies