cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

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 histogram.

Period (month)
Login count       Count of User ID:s
>10                   120

9                        58

8                        62

7                        70
6                        75
5                        80
4                        90
...


Here is the table I'm working with:


Login table

Any ideas how I can do this? 

Thanks in advance! 

Axel

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Calculate login count

@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.

View solution in original post

3 REPLIES 3
Highlighted
Community Support
Community Support

Re: Calculate login count

@alexsimonsson,

 

Could you post same sample data of login table and clarify more details about your requirement?

 

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.

Highlighted
Regular Visitor

Re: Calculate login count

This is the data I'm working with: 
Login_table2.PNG

What I want to do with this data, is that I want to count the logins and then show how many users (user_id:s) logged in per login count group. So that I can visualise that there was X amount of users that logged in 2 times in a month and X amount of users that logged in over 10 times: 

Example.PNG

Thank you in advance

Highlighted
Community Support
Community Support

Re: Calculate login count

@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.

View solution in original post

Helpful resources

Announcements
Meet the 2020 Season 2 Power BI Super Users!

Meet the 2020 Season 2 Power BI Super Users!

Find out who's part of the program this season, and welcome the new Super Users.

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

July 2020 Community Highlights

July 2020 Community Highlights

Learn about the exciting things that happened in July.

Featured Data Story of The Month

Featured Data Story of The Month

All Data Stories Gallery contributions are reviewed for each month. We select a contribution and feature the community member the following month.

Power BI Dev Camp - Developing with .NET Core

Power BI Dev Camp - Developing with .NET Core

Learn how to develop custom web applications for Power BI using .NET Core 3.1 and .NET 5.

Top Solution Authors
Top Kudoed Authors