Forum Discussion

alexsimonsson's avatar
alexsimonsson
Regular Visitor
7 years ago
Solved

Calculate login count

Hello,  I have table with information about user logins. As I'm trying to get data about the activity of the users I'd like to show the login count as shown below and then convert this to histogra...
  • v-yuta-msft's avatar
    v-yuta-msft
    7 years ago

    alexsimonsson,

     

    To be general, you may refer to steps below:

     

    1. Create a calculate column to achieve the month:

    Month =
    MONTH ( Table[created_at] )
    

    2. Create a slicer based on Logins/months column in anithort table.

    3. Create a calculate column to achieve the login times per month per id using DAX below:

    count =
    CALCULATE ( COUNT ( Table[id] ), ALLEXCEPT ( Table, Table[Month], Table[id] ) )

    4. Create a measure to achieve the login count:

    Users =
    IF (
        Table2[Logins/months] <> ">10",
        CALCULATE (
            DISTINCTCOUNT ( Table[id] ),
            FILTER ( Table, Table[count] = SELECTEDVALUE ( Table2[Logins/month] ) )
        ),
        CALCULATE ( DISTINCTCOUNT ( Table[id] ), FILTER ( Table, Table[count] >= 10 ) )
    )
    

    5. Drag measure 'Users' and the Logins/month column to the table visual.

     

    Community Support Team _ Jimmy Tao

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.