Forum Discussion
Employment conversion rate measure calculation
Dear community,
Below you can find the data related to a recruitment process. What I want is to calculate a conversion rate between 2 phase of this process (Stat 11 to 20).
| Timestamp | Reference ID | Name | stat | highlighted |
| 7/08/2020 0:04 | C_a118 | name1147 | 1 | |
| 14/08/2020 16:08 | C_a118 | name1147 | 11 | X |
| 27/08/2020 9:45 | C_a118 | name1147 | 20 | |
| 7/08/2020 2:32 | C_a118 | name1291 | 1 | |
| 4/08/2020 14:12 | C_a118 | name0630 | 11 | X |
| 6/10/2020 13:15 | C_a127 | name0325 | 1 | |
| 22/09/2020 10:52 | C_a127 | name0544 | 11 | |
| 21/08/2020 2:49 | C_a129 | name1323 | 1 | |
| 22/09/2020 15:51 | C_a129 | name1323 | 11 | X |
| 14/09/2020 9:14 | C_a129 | name1324 | 11 | X |
| 12/10/2020 9:24 | C_a129 | name1323 | 20 | |
| 14/10/2020 9:14 | C_a129 | name1326 | 11 |
each time the stat column change we record it in a row with a time stamp. Refrence_ID shows the position we want to recruit and name is the name of the applicant. and stat show the status of applicant for the process. what I want to calculate is the conversion rate between stat 11(just those records with the stat of 11 that highlighted with X should be counted for my measure) to 20.
Conversion rate = (distinct number of applicant who have stat of 20) / (distinct number of applicants who have stat of 11 for the same positions that somebody get stat 20 and with a time stamp equal or less than the max timestamp of the person get stat 20 for that position)
for this very little example the result should be sth like this:
conversion rate=2/4=0.5
Does anyone can help me write the related dax measure?
Thank you in advance for your help and support!
Hi SadStatue,
I updated the demo, please refer: Employment-conversion-rate-measure-calculation
Here is the output:
Best Regards,
Link
15 Replies
- amitchandakSuper User
SadStatue , Try a measure like
divide(calculate(distinctcount(Table[Name]), filter(Table, Table[stat] = 20)),calculate(distinctcount(Table[Name]), filter(Table, Table[stat] = 11)))
- SadStatueHelper II
Hi amitchandak
Thank you for your quick response.
No it wont work as u just simply filter just by stat while I have 2 more conditions (it is 2/6=0.33 which is not what I want)
1. Calculating number of applicant with stat 11 for the same positions(Reference ID) that sb get stat 20
2. Time stamp of records with stat 11 should be equal or before the time stamp of the records with stat 20 for that position (Reference ID)
I've amended the main post sample data and marked those records with sat of 11 that want to be calculated in my measure with X. As u see there are 2 records with stat of 11 which is not marked one of them is for C_a 127, as no one get stat 20 for this reference ID (position) and the other one is the last line record, and its not marked as its time stamp is after the time stamp of the record one to last (the one that have stat 20 for the same refrence ID)
You can also find the whole data and a larger sample data in the hyper link of the main post.
I hope I could shed some light on the issue by this extra description.
Cheers,
- v-xulin-mstfCommunity Support
Hi SadStatue,
Create two measures as:
Measure = var _reference=CALCULATE(MAX('Table'[Reference ID]),FILTER('Table','Table'[Molecular]=1)) var _datestamp=CALCULATE(MAX('Table'[Timestamp]),FILTER('Table','Table'[Molecular]=1 && 'Table'[Reference ID]=_reference)) var a=CALCULATETABLE(VALUES('Table'[Name]),FILTER(ALL('Table'), 'Table'[stat]=20)) var b=CALCULATETABLE(VALUES('Table'[Name]),FILTER(ALL('Table'),'Table'[Timestamp]<_datestamp && 'Table'[stat]=11&&'Table'[Reference ID]=_reference)) Return COUNTROWS(a)/COUNTROWS(b)Molecular = IF(MAX('Table'[stat])=20,1,0)Here is the output:
Here is the demo, please try it: Employment conversion rate measure calculation
Best Regards,
Link
- SadStatueHelper II
Hi v-xulin-mstf
Thank you so much for your time and effort on my problem.
i dont think its working as I implement it for the data I've mentioned in the main post and it brings infinity. So I believe variable "b" is not calculating as we want.
Cheers,
- v-xulin-mstfCommunity Support
Hi SadStatue,
I have modified the measure.
Here is the output:
Here is the demo, please try it: Employment conversion rate measure calculation
Best Regards,
Link