Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Function to count one login value per day, Shown in bins

Hello, I have been learning a lot form the forum but I am breaking my head over the following:

 

I would like to show the number of days users have loggedin and aggregate those in bins in a bar chart. 

 

With = DistinctCount([UserID-DateOfLogin]) I can show the following graph.

[UserID-DateOfLogin] = a combination of the columns [UserID] and [DateOfLogin]

I have grouped my data on [UserID] and [DateOfLogin] so I do not have any duplicates per user per day.

 
 

GraphLoginsPerday.PNG

 

What I would like to show is a graph which shows the number of users that loggedin 0 times, 1 - 5 times, 6 - 10 times, 11 - 15 times and 15 > times. Over a dynamic period specified by a date slicer on the same BI. (I already have a data calendar setup and linked to the "DateOfLogin" column in my Logins tabel.

 

I think I am nearly there but I cannot get there.

 

Hope someone can help. 

 

My data model:

DataLogins.png

 

1 ACCEPTED SOLUTION

Hi @Anonymous 

 

Try this

Bins = 
CALCULATE(
    [LoginDays];
    FILTER(
        LoginData;
        AND( [LoginDays] >= MIN( BinUsoCrm[Min] ); [LoginDays] <= MAX( BinUsoCrm[Max] ) )
    )
)
Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

Mariusz
Community Champion
Community Champion

Hi @Anonymous 

Try these two articles.

https://www.daxpatterns.com/dynamic-segmentation/

https://www.daxpatterns.com/static-segmentation/

 

by the way, you can avoid creating extra columns by creatin measure like.

Measure = 
COUNTROWS(
    SUMMARIZE( 
        YourTableName, 
        YourTableName[UserID], 
        YourTableName[DateOfLogin]
    )
)

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Anonymous
Not applicable

Hello @Mariusz @amitchandak 

 

Thank you for your quick response!

The Groups / Banding part I have already in my BI:

 

Bins = CALCULATE(COUNTROWS(FILTER(LoginData;AND([LoginDays] >= MIN(BinUsoCrm[Min]);[LoginDays] <= MAX(BinUsoCrm[Max])))))
LoginDays = DISTINCTCOUNT(LoginData[UserIDDateOfLogin])
 

Min Max Name

0     0      0

1     5      1-5

6     10    6-10

11   15    11-15

16   1000  15 >    

 

 

But what is missing is the combination of that with the DISTINCTCOUNT(UserIDDateOfLogin) into a graph. It is really driving me crazy becuase I see the parts but I cannot get them to work together.

 

Thomas

Hi @Anonymous 

 

Try this

Bins = 
CALCULATE(
    [LoginDays];
    FILTER(
        LoginData;
        AND( [LoginDays] >= MIN( BinUsoCrm[Min] ); [LoginDays] <= MAX( BinUsoCrm[Max] ) )
    )
)
Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.