Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I have a table as below. I am tryingt to get the headcount as on a particular date. For example, as on 12-Nov-2016, 5 people have joined and 2 have left, so the headcount stands at 3.
I have created two measures as below. But here I can only calculate as on today. Is there a way to pass a parameter instead of today? Or a different way of calculating?
Total Joiners = CALCULATE( COUNTA(HCRaw[Name]), DATESBETWEEN(HCRaw[JD].[Date], DATE(2016,1,1), Today()))
Total Leavers = CALCULATE( COUNTA(HCRaw[Name]), DATESBETWEEN(HCRaw[LD].[Date], DATE(2016,1,1), Today()))
+------+--------------+--------------+
| Name | JD | LD |
+------+--------------+--------------+
| ALSK | 01-Aug-2016 | 12-Nov-2016 |
| IKL | 09-Oct-2016 | |
| ASK | 09-Oct-2016 | |
| ASL | 10-Oct-2016 | |
| KOL | 12-Nov-2016 | |
| IKL | 15-Dec-2016 | 20-Jan-2017 |
| ABC | 21-Dec-2016 | 24-Jan-2017 |
| DEF | 20-Jan-2017 | |
| GHI | 24-Jan-2017 | 10-Oct-2016 |
+------+--------------+--------------+
-Shashanka
Hi @Anonymous,
Currently, query parameter can't be passed to the measure. In your scenario, to calculate joined / leave employees per day, you can create a calendar table like below:
Calendar = CALENDAR(MIN('HCRaw'[JD]),MAX('HCRaw'[LD]))
Then create three measures in the HCRaw table:
JoinedPerDay = CALCULATE(COUNTA(HCRaw[Name]),FILTER(ALL(HCRaw),'HCRaw'[JD]=MAX('Calendar'[Date])))
LeavePerDay = CALCULATE(COUNTA(HCRaw[Name]),FILTER(ALL(HCRaw),'HCRaw'[LD]=MAX('Calendar'[Date])))
Headcount = 'HCRaw'[JoinedPerDay]-'HCRaw'[LeavePerDay]
Please see attached .pbix file.
Best Regards,
Qiuyun Yu
Thanks @v-qiuyu-msft
I am looking for a different solution that what you've calculated. I do not want to know the HC for a particular day, I want to HC as on a particualr day. So it should consider overall HC.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |