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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
third_hicana
Helper IV
Helper IV

Count person who are joining and leaving

Hi. Seeking for your help regarding DAX.

I want to create a DAX that counts the people who join and leave the online event. I have created a visual that counts who joins in a specific hour. However, I wish to make a visual that adds the people to the count who join the online event and subtracts the number of people who leave in an hourly interval.

third_hicana_0-1713498783908.png

 

Below is the sample data

Namestart_timeend_timeduration (seconds)Duration (Minutes)Duration (Hour)
PERSON_113112/03/2024 6:48:55 am12/03/2024 6:48:56 am100
PERSON_128212/03/2024 6:49:10 am12/03/2024 6:49:19 am90.20
PERSON_132012/03/2024 6:49:26 am12/03/2024 6:49:34 am80.10
PERSON_132612/03/2024 6:50:57 am12/03/2024 6:51:06 am490.80
PERSON_110712/03/2024 6:53:47 am12/03/2024 6:53:53 am60.10
PERSON_107612/03/2024 6:58:49 am12/03/2024 6:58:51 am200
PERSON_100412/03/2024 6:49:12 am12/03/2024 6:59:40 am102817.10.3
PERSON_121712/03/2024 7:00:39 am12/03/2024 7:00:44 am50.10
PERSON_129812/03/2024 7:00:24 am12/03/2024 7:00:44 am200.30
PERSON_121712/03/2024 7:00:56 am12/03/2024 7:00:59 am300
PERSON_142612/03/2024 6:50:25 am12/03/2024 7:01:00 am507584.61.4
PERSON_132612/03/2024 6:51:14 am12/03/2024 7:01:07 am499383.21.4
PERSON_108112/03/2024 7:01:20 am12/03/2024 7:01:23 am300
PERSON_142612/03/2024 7:01:21 am12/03/2024 7:01:24 am300
PERSON_132612/03/2024 7:01:12 am12/03/2024 7:01:57 am450.80
PERSON_113012/03/2024 7:02:05 am12/03/2024 7:02:08 am300
PERSON_100612/03/2024 7:02:13 am12/03/2024 7:02:14 am100
PERSON_106812/03/2024 7:00:54 am12/03/2024 7:02:18 am1642.70
PERSON_123112/03/2024 7:02:32 am12/03/2024 7:02:35 am300
PERSON_107612/03/2024 7:02:42 am12/03/2024 7:02:44 am200
PERSON_106012/03/2024 7:02:50 am12/03/2024 7:02:51 am100
PERSON_114712/03/2024 7:02:19 am12/03/2024 7:02:55 am360.60
PERSON_121012/03/2024 7:03:19 am12/03/2024 7:03:20 am100
PERSON_156412/03/2024 7:02:51 am12/03/2024 7:03:26 am751.20
PERSON_158112/03/2024 7:01:39 am12/03/2024 7:03:36 am1973.30.1
PERSON_105112/03/2024 7:03:34 am12/03/2024 7:03:48 am140.20
PERSON_107412/03/2024 7:04:29 am12/03/2024 7:04:31 am200
1 REPLY 1
rajendraongole1
Super User
Super User

Hi @third_hicana - create a calculated columns for the start and end hours in your main table.

 

Start Hour = HOUR([start_time])
End Hour = HOUR([end_time])
 
Create a separate table for the hours
HoursTable = DISTINCT(SELECTCOLUMNS('_Perso', "Hour", HOUR('_Perso'[start_time])))
create the measures to count people joining and leaving within each hour:
People Joining =
VAR SelectedHour = SELECTEDVALUE('HoursTable'[Hour])
RETURN
CALCULATE(
    COUNTROWS('_Perso'),
    FILTER('_Perso', HOUR('_Perso'[start_time]) = SelectedHour)
)
 
People Leaving =
VAR SelectedHour = SELECTEDVALUE('HoursTable'[Hour])
RETURN
CALCULATE(
    COUNTROWS('_Perso'),
    FILTER('_Perso', HOUR('_Perso'[end_time]) = SelectedHour)
)
 
rajendraongole1_0-1722927814458.png

 

 

Hope it works





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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