Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hello everyone, I'm relatively new to PowerBI, and I've done a fair amount of research and tried different approaches without success. The idea is to show how many people joined the company in a particular month, how many left, and the number of active users in a specific month/year.
I have a table with user information with columns id, start date, and end date, and I want to create a clustered column chart with three categories:
- users with a start date in the current month named "Joiners".
- users with an end date in the current month named "Leavers".
- users with a start date before the current month and an end date blank named "Active".
Data looks like this, when an user is still active, then End Date is blank.
ID Start Date End Date
1312313 01/23/2020 12/24/2021
1231231 08/15/2021 09/01/2022
2534556 12/20/2022
4356546 01/01/2023 04/20/2023
2534556 10/12/2021
4356546 02/13/2020
This is an example of what I'm trying to get. Would you help me with that or point me in the right direction? Any help will be highly appreciated.
Solved! Go to Solution.
Just i case someone is looking for the answer, I found it here:
Hello @johan-svitla
How would you define current month, Will you be using a slicer?
Also if start_date & end_date falls on current month, What would be the status.
Regards,
Naveen
Hi. Yes, the slicer would be my choice. If someone joined and left in the same month should be counted in both joiners and leavers.
Regards and thanks for your interest
@johan-svitla
Id 4356546 has two entries, can you let me know what should be the desired output in such cases?
Hi, this is a mistake on the sample data. IDs are unique and are never duplicated under any circumstance
Please try the below solution, This uses a combination of PQ and DAX.
Unpivot your table to below structure, as this is important to visuals leavers along with other two metric.
Create below three measures, Use a disconnected calendar table for slicer and alter the measure accordingly.
Joiners =
CALCULATE (
COUNT ( Active[ID ] ),
FILTER (
Active,
IF (
AND (
MAX ( 'Calendar'[Month] ) = MONTH ( MAX ( Active[Date] ) ),
MAX ( 'Calendar'[year] ) = YEAR ( MAX ( Active[Date] ) )
),
1,
0
) = 1
),
Active[Type] = "Start Date"
)
Leavers =
CALCULATE (
COUNT ( Active[ID ] ),
FILTER (
Active,
IF (
AND (
MAX ( 'calendar'[Month] ) = MONTH ( MAX ( Active[Date] ) ),
MAX ( 'Calendar'[year] ) = YEAR ( MAX ( Active[Date] ) )
),
1,
0
) = 1
),
Active[Type] = "End Date"
)
Active =
VAR value_ =
LOOKUPVALUE (
'Calendar'[Date],
'Calendar'[Date], SELECTEDVALUE ( Active[Date] )
)
RETURN
CALCULATE (
COUNT ( Active[ID ] ),
FILTER (
Active,
IF (
AND (
CALCULATE ( COUNTROWS ( Active ), ALLEXCEPT ( Active, Active[ID ] ) ) = 1,
MONTH ( value_ ) < SELECTEDVALUE ( 'Calendar'[Month] )
&& YEAR ( value_ ) <= SELECTEDVALUE ( 'Calendar'[Year] )
),
1,
0
) = 1
)
)
Now use the date column and these three measure to visualize as below.
Let me know if this helps.
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
82 | |
81 | |
52 | |
39 | |
34 |
User | Count |
---|---|
95 | |
78 | |
52 | |
49 | |
47 |