Question about GPA and college classes

L

Switching my major after my current class. This class does not apply to my major therefore the credit isn’t valid for my degree. My question is: does the grade I get go towards my GPA still or does it not apply since it doesn’t apply towards my new degree? TIA