The context is absent, but I believe it references the drinking of alcohol, and it is an ellipsis. It would read this way without: It got so [that] I couldn't tell [after I became drunk] if [it was because] I was sad or just thirsty. This is verbose colloquial speech.
More linearly, "I don't know if I got drunk because I was sad or just thirsty." This is the appropriate way to write English. Don't imitate what is above.