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

How to count number of sessionIDs per userID per Minute?

Hello,
I need to count, the number of sessionIDs per UserID per minute.

For example: 

Number of User Id's = 10

Number of session Id's per userID = 2

Time = 12:01:00

So, In 1 minute there are 2 session Id's per userID.

 

Kindly suggest a measure of formula to calculate this.

1 ACCEPTED SOLUTION

Hi, @Anonymous 

 

You can try the following methods.
Measure:

Count = CALCULATE(COUNT('Table'[sessionid]),ALLEXCEPT('Table','Table'[userid],'Table'[timestamp]))

vzhangti_0-1679035293842.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

4 REPLIES 4
Greg_Deckler
Super User
Super User

@Anonymous Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hello @Greg_Deckler 
Have a look at the data.

 

timestampuseridsessionid
18-02-2023 00:1064390894771888f4e231e88845d7bae5d058ee6fe979
18-02-2023 00:1064390894771888f4e231e88845d7bae5d058ee6fe980
18-02-2023 00:1692004729373888f4e231e88845d7bae5d058ee6fe981
18-02-2023 00:1692004729373888f4e231e88845d7bae5d058ee6fe982
18-02-2023 00:1692004729373988f4e231e88845d7bae5d058ee6fe983
18-02-2023 00:1692004729373988f4e231e88845d7bae5d058ee6fe984
18-02-2023 00:1766811281524088f4e231e88845d7bae5d058ee6fe985
18-02-2023 00:1766811281524088f4e231e88845d7bae5d058ee6fe986
18-02-2023 00:1666811281524188f4e231e88845d7bae5d058ee6fe987
18-02-2023 00:1666811281524188f4e231e88845d7bae5d058ee6fe988
18-02-2023 00:1891528002542688f4e231e88845d7bae5d058ee6fe989
18-02-2023 00:1891528002542688f4e231e88845d7bae5d058ee6fe990
18-02-2023 00:18111111111188f4e231e88845d7bae5d058ee6fe991
18-02-2023 00:18111111111188f4e231e88845d7bae5d058ee6fe992
18-02-2023 00:1911558668712788f4e231e88845d7bae5d058ee6fe993
18-02-2023 00:1911558668712788f4e231e88845d7bae5d058ee6fe994
18-02-2023 00:1911558668712988f4e231e88845d7bae5d058ee6fe995
18-02-2023 00:1911558668712988f4e231e88845d7bae5d058ee6fe996
18-02-2023 00:2229419883654388f4e231e88845d7bae5d058ee6fe997
18-02-2023 00:2229419883654388f4e231e88845d7bae5d058ee6fe998

 

So in a given minute, there are 2 session IDs per userID. 
Can you help to create a measure to calculate this for a Large dataset?

 

Thanks in advance.

Regards,
AJP

Hi, @Anonymous 

 

You can try the following methods.
Measure:

Count = CALCULATE(COUNT('Table'[sessionid]),ALLEXCEPT('Table','Table'[userid],'Table'[timestamp]))

vzhangti_0-1679035293842.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

@Anonymous Maybe this? 

Measure = AVERAGEX(SUMMARIZE('Table',[timestamp],"__Count",DIVIDE(COUNTROWS('Table'),COUNTROWS(DISTINCT('Table'[userid])))),[__Count])

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.