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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Find Concurrent Usage

Hi,

 

I am trying to find the peak/concurrent usage of an application during the day.

From my table named: wrl_tbl_log_1

luidbegin_timeend_time
20993/5/2020 4:03:02 PM3/5/2020 4:06:45 PM
20993/5/2020 4:25:32 PM3/5/2020 4:27:25 PM
21003/5/2020 1:11:57 PM3/5/2020 8:42:07 PM
20993/5/2020 3:29:30 PMnull
21003/5/2020 3:35:38 PMnull
20993/5/2020 6:38:09 PM3/5/2020 7:04:04 PM

 

I am stumped trying to determine how the dates all overlap over eachother.

My end goal is to find the overlap during a day and make a graph like the following.

 

Peak Usage Photo.PNG

 

If someone could point me in the correct direction, I would really appreciate it.

 

-M

1 ACCEPTED SOLUTION
stretcharm
Memorable Member
Memorable Member

 

You could create a list of all the hours with an active Usage record.

 

You can either have a table of hours or generate them in M

 

let
    Source = List.Generate(()=>0, each _ < 24, each _ + 1),
    #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"Column1", Int64.Type}}),
    #"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Column1", "Hour"}})    
in
    #"Renamed Columns"

 

 

Now we can cross join the Usage data and filter just the hours that are between the start and end.

Create a New Dax Table (under Modeling)

 

HourUsage = FILTER(CROSSJOIN(Hours,'Usage'), AND(Hours[Hour]>=Hour(Usage[begin_time]), Hours[Hour]<=HOUR(Usage[end_time]) ))

 

 

You can then chart the hours and count distinct uids.

 

app_usage.PNG

View solution in original post

4 REPLIES 4
stretcharm
Memorable Member
Memorable Member

 

You could create a list of all the hours with an active Usage record.

 

You can either have a table of hours or generate them in M

 

let
    Source = List.Generate(()=>0, each _ < 24, each _ + 1),
    #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"Column1", Int64.Type}}),
    #"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Column1", "Hour"}})    
in
    #"Renamed Columns"

 

 

Now we can cross join the Usage data and filter just the hours that are between the start and end.

Create a New Dax Table (under Modeling)

 

HourUsage = FILTER(CROSSJOIN(Hours,'Usage'), AND(Hours[Hour]>=Hour(Usage[begin_time]), Hours[Hour]<=HOUR(Usage[end_time]) ))

 

 

You can then chart the hours and count distinct uids.

 

app_usage.PNG

Anonymous
Not applicable

Thanks! This solves the small problem. You taught me how CROSSJOIN works. Now I can expand the problem and learn how to perform my larger task. 

Glad it works.

 

Curbal has some more details/videos on the different dax joins

https://curbal.com/blog/glossary/crossjoin-dax

 

Greg_Deckler
Super User
Super User

Check out Open Tickets. It was designed for this. https://community.powerbi.com/t5/Quick-Measures-Gallery/Open-Tickets/m-p/409364#M147

 



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! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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