Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Vtomsons
Helper I
Helper I

DAX for New Registrations after a previous free course Registration

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 IDOfferings NameCourses NameRegistration StatusRegistration start dateRegistration end dateRegistration TypeReg'd Next Course# new course Reg'n
Ryan MolnarCOHS 3110 20/SMCOHS 3110Completed05/05/202020/07/2020   
Ryan MolnarCOHS 3120 20/SMCOHS 3120Completed     
Ryan MolnarCOHS 3130 20/SMCOHS 3130Completed     
Ryan MolnarCOHS 3210 20/SMCOHS 3210Expired04/06/202013/08/2020   
Ryan MolnarCOHS 3210 22/WICOHS 3210Extended13/01/202224/03/2022Re-Reg'nFALSE 
Ryan MolnarCOHS 3220 20/SMCOHS 3220Completed04/06/202013/08/2020   
Ryan MolnarCOHS 3230 20/SMCOHS 3230Completed04/06/202013/08/2020   
Ryan MolnarCOHS 3310 20/SMCOHS 3310Expired04/06/202013/08/2020   
Ryan MolnarCOHS 3310 22/WICOHS 3310Extended13/01/202224/03/2022Re-Reg'nFALSE 
Janean StoryDOHS 4111 19/FADOHS 4111Completed24/09/201926/12/2019   
Janean StoryDOHS 4131 19/FADOHS 4131Completed10/12/201912/03/2020   
Janean StoryDOHS 4151 20/WIDOHS 4151Expired01/04/202002/07/2020   
Janean StoryDOHS 4151 21/WIDOHS 4151Expired07/01/202108/04/2021Re-Reg'n  
Janean StoryDOHS 4151 22/WIDOHS 4151Completed20/01/202221/04/2022Re-Reg'nFALSE 
Shaun PylypiwCOHS 3110 19/FACOHS 3110Completed27/09/201909/12/2019   
Shaun PylypiwCOHS 3120 19/FACOHS 3120Completed09/10/201919/12/2019   
Shaun PylypiwCOHS 3130 19/FACOHS 3130Completed24/10/201906/01/2020   
Shaun PylypiwCOHS 3210 20/WICOHS 3210Completed11/01/202023/03/2020   
Shaun PylypiwCOHS 3220 20/WICOHS 3220Expired24/01/202006/04/2020   
Shaun PylypiwCOHS 3220 21/SMCOHS 3220Completed16/08/202125/10/2021   
Shaun PylypiwCOHS 3230 20/WICOHS 3230Expired27/01/202009/04/2020   
Shaun PylypiwCOHS 3230 21/FACOHS 3230Completed28/10/202106/01/2022Re-Reg'nTRUE2
Shaun PylypiwCOHS 3310 20/WICOHS 3310Expired30/01/202013/04/2020   
Shaun PylypiwCOHS 3310 21/FACOHS 3310Completed08/11/202117/01/2022Re-Reg'nTRUE2
Shaun PylypiwCOHS 3320 20/WICOHS 3320Expired02/02/202013/04/2020   
Shaun PylypiwCOHS 3320 21/FACOHS 3320Completed08/11/202117/01/2022Re-Reg'nTRUE2
Shaun PylypiwCOHS 3330 21/FACOHS 3330Completed08/11/202117/01/2022   
Shaun PylypiwCOHS 3340 21/FACOHS 3340Completed15/11/202124/01/2022   
Shaun PylypiwCOHS 3410 22/WICOHS 3410Extended28/04/202207/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!

1 ACCEPTED SOLUTION
Vtomsons
Helper I
Helper I

Actually I realised I had my date field not set properly. once formatted correctly the result was correct.

 

Thanks for your interest.

View solution in original post

4 REPLIES 4
Vtomsons
Helper I
Helper I

Actually I realised I had my date field not set properly. once formatted correctly the result was correct.

 

Thanks for your interest.

v-yalanwu-msft
Community Support
Community Support

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.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.