The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Description:
Hello Power BI Community,
I'm seeking help with creating a DAX measure in Power BI to calculate the number of remaining active joiners each month after their joining month. I have two main tables: JoinersSummary and NewJoinerAndLeavers, both connected to a Calender table.
Objective:
Data Structure:
Current Issue: I have created a measure to calculate remaining joiners, but it currently returns the same count as the new joiners, rather than the count of those who are still active after the joining month. The goal is to have a measure that correctly identifies and counts the remaining active joiners for each month.
Remaining Joiners Optimized =
VAR SelectedMonth = MAX('JoinersSummary'[Merged])
VAR JoinersInSelectedMonth =
CALCULATETABLE(
VALUES('JoinersSummary'[SimNo]),
'JoinersSummary'[IsNewJoiner] = 1,
'JoinersSummary'[Merged] = SelectedMonth,
REMOVEFILTERS('NewJoinerAndLeavers')
)
VAR RemainingJoinersCount =
CALCULATE(
DISTINCTCOUNT('NewJoinerAndLeavers'[SimNo]),
'NewJoinerAndLeavers'[SimNo] IN JoinersInSelectedMonth,
'NewJoinerAndLeavers'[Merged] > SelectedMonth,
REMOVEFILTERS('Calender')
)
RETURN
RemainingJoinersCount
This measure returns the same count as the new joiners count, not reflecting the actual number of joiners remaining active after the joining month.
Additional Information:
Request: I need guidance on correctly calculating the remaining active joiners for each subsequent month after their joining month. Any insights or suggestions would be greatly appreciated.
Thank you for your help!
It seems like the issue with your current DAX measure is that it's not accounting for leavers in the months following the joiners' initial month. Maybe you can try the following Dax:
Remaining Active Joiners =
VAR SelectedMonth = MAX('JoinersSummary'[Merged])
VAR JoinersInSelectedMonth =
CALCULATETABLE(
VALUES('JoinersSummary'[SimNo]),
'JoinersSummary'[IsNewJoiner] = 1,
'JoinersSummary'[Merged] = SelectedMonth
)
VAR RemainingJoiners =
FILTER(
JoinersInSelectedMonth,
CALCULATE(
COUNTROWS('NewJoinerAndLeavers'),
'NewJoinerAndLeavers'[SimNo] = EARLIER('JoinersSummary'[SimNo]),
'NewJoinerAndLeavers'[Merged] > SelectedMonth,
'NewJoinerAndLeavers'[ThreeMonthLeaver] = 0
) > 0
)
RETURN
COUNTROWS(RemainingJoiners)
Best Regards,
Jayleny
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
hi @Anonymous Thank you for the respone. The solution you gave still produce the correct number of joiners but not the remaining joiners.
Look at the image.
User | Count |
---|---|
13 | |
8 | |
6 | |
6 | |
5 |
User | Count |
---|---|
24 | |
14 | |
13 | |
8 | |
8 |