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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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.



Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

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])


Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.