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.
Hi,
My Dax code is not doing exactly what I want it to do. I am trying to return on the row level for a registration type of "Re-Reg'n" that has a registration status of "Completed" to show the student registered in another course at a later Registrartion start date that was not another "Re-Reg'n". Here is my code that is not working:
Next Course Reg'n =
if([Registration Type]="Re-Reg'n" || [Registration Status]="Completed",
var c = [Student ID]
var cs = [Registration Type]
var sd = [Registration start date]
var r = calculate(COUNTROWS('ONLINE Reg''n'),ALL('ONLINE Reg''n'),'ONLINE Reg''n'[Student ID]=c,'ONLINE Reg''n'[Registration Type]<>"Re-Reg'n",'ONLINE Reg''n'[Registration start date]>sd)
return if(r>0,"True","False"))
Currently, all three of these Student Id's are returning a TRUE result when really only the third Student meets the criteria I am looking for.
Student ID | Offerings Name | Courses Name | Registration Status | Registration start date | Registration end date | Registration Type | Reg'd Next Course | # new course Reg'n |
Ryan Molnar | COHS 3110 20/SM | COHS 3110 | Completed | 05/05/2020 | 20/07/2020 | |||
Ryan Molnar | COHS 3120 20/SM | COHS 3120 | Completed | |||||
Ryan Molnar | COHS 3130 20/SM | COHS 3130 | Completed | |||||
Ryan Molnar | COHS 3210 20/SM | COHS 3210 | Expired | 04/06/2020 | 13/08/2020 | |||
Ryan Molnar | COHS 3210 22/WI | COHS 3210 | Extended | 13/01/2022 | 24/03/2022 | Re-Reg'n | FALSE | |
Ryan Molnar | COHS 3220 20/SM | COHS 3220 | Completed | 04/06/2020 | 13/08/2020 | |||
Ryan Molnar | COHS 3230 20/SM | COHS 3230 | Completed | 04/06/2020 | 13/08/2020 | |||
Ryan Molnar | COHS 3310 20/SM | COHS 3310 | Expired | 04/06/2020 | 13/08/2020 | |||
Ryan Molnar | COHS 3310 22/WI | COHS 3310 | Extended | 13/01/2022 | 24/03/2022 | Re-Reg'n | FALSE | |
Janean Story | DOHS 4111 19/FA | DOHS 4111 | Completed | 24/09/2019 | 26/12/2019 | |||
Janean Story | DOHS 4131 19/FA | DOHS 4131 | Completed | 10/12/2019 | 12/03/2020 | |||
Janean Story | DOHS 4151 20/WI | DOHS 4151 | Expired | 01/04/2020 | 02/07/2020 | |||
Janean Story | DOHS 4151 21/WI | DOHS 4151 | Expired | 07/01/2021 | 08/04/2021 | Re-Reg'n | ||
Janean Story | DOHS 4151 22/WI | DOHS 4151 | Completed | 20/01/2022 | 21/04/2022 | Re-Reg'n | FALSE | |
Shaun Pylypiw | COHS 3110 19/FA | COHS 3110 | Completed | 27/09/2019 | 09/12/2019 | |||
Shaun Pylypiw | COHS 3120 19/FA | COHS 3120 | Completed | 09/10/2019 | 19/12/2019 | |||
Shaun Pylypiw | COHS 3130 19/FA | COHS 3130 | Completed | 24/10/2019 | 06/01/2020 | |||
Shaun Pylypiw | COHS 3210 20/WI | COHS 3210 | Completed | 11/01/2020 | 23/03/2020 | |||
Shaun Pylypiw | COHS 3220 20/WI | COHS 3220 | Expired | 24/01/2020 | 06/04/2020 | |||
Shaun Pylypiw | COHS 3220 21/SM | COHS 3220 | Completed | 16/08/2021 | 25/10/2021 | |||
Shaun Pylypiw | COHS 3230 20/WI | COHS 3230 | Expired | 27/01/2020 | 09/04/2020 | |||
Shaun Pylypiw | COHS 3230 21/FA | COHS 3230 | Completed | 28/10/2021 | 06/01/2022 | Re-Reg'n | TRUE | 2 |
Shaun Pylypiw | COHS 3310 20/WI | COHS 3310 | Expired | 30/01/2020 | 13/04/2020 | |||
Shaun Pylypiw | COHS 3310 21/FA | COHS 3310 | Completed | 08/11/2021 | 17/01/2022 | Re-Reg'n | TRUE | 2 |
Shaun Pylypiw | COHS 3320 20/WI | COHS 3320 | Expired | 02/02/2020 | 13/04/2020 | |||
Shaun Pylypiw | COHS 3320 21/FA | COHS 3320 | Completed | 08/11/2021 | 17/01/2022 | Re-Reg'n | TRUE | 2 |
Shaun Pylypiw | COHS 3330 21/FA | COHS 3330 | Completed | 08/11/2021 | 17/01/2022 | |||
Shaun Pylypiw | COHS 3340 21/FA | COHS 3340 | Completed | 15/11/2021 | 24/01/2022 | |||
Shaun Pylypiw | COHS 3410 22/WI | COHS 3410 | Extended | 28/04/2022 | 07/07/2022 |
I'd also like to count how many new registrations in another new column so I can calculate the amount of revenue this student has produced with the new registrations that were not "Re-Reg'n".
Any help is greatly appreciated.
Thanks!
Solved! Go to Solution.
Actually I realised I had my date field not set properly. once formatted correctly the result was correct.
Thanks for your interest.
Actually I realised I had my date field not set properly. once formatted correctly the result was correct.
Thanks for your interest.
Hi , @Vtomsons ;
Sorry, I don't understand your thinking logic very well, can you describe it a little more clearly, and the result you want to output?
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
I realised later I was using the OR (||) rather the the AND (&&) symbols so all good with my previous question.
I do have a follow up to solve for the amount that is R from the previous code (called Next Course Amount). Code below is doing a good job in returning the amount of registrations after the identified start date but if the start date is the same for more then one registration (Course offering) for the same student, R is counting only one rather then 2 or 3. It makes sense as I am asking to count registration start dates so maybe I should count offerings when the start date could be the same for multiple offerings. Just not sure how to fit in offerings to the code below. Let me lknow if anyone has any suggestions.
Next Course Amount =
IF([Registration Type]="Re-Reg'n" && [Registration Status]="Completed",
var s = [Student ID]
var rt = [Registration Type]
var cn = [Offerings Name]
var sd = [Registration start date]
var r = calculate(COUNTROWS('ONLINE Reg''n'),ALL('ONLINE Reg''n'),'ONLINE Reg''n'[Student ID]=s,'ONLINE Reg''n'[Registration Type]<>"Re-Reg'n",'ONLINE Reg''n'[Registration start date]>sd)
return r)
Hi,
Share some data to work with and show the expected result.
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 |
---|---|
96 | |
95 | |
82 | |
71 | |
64 |
User | Count |
---|---|
115 | |
105 | |
95 | |
79 | |
72 |