Forum Discussion
bonjourposte
2 years agoHelper V
How do I add three variables?
I want monthly totals of how many advances we sent out, and how many collections we took in.
Advances worked fine because there is only one source of money going out.
My measure was fairly simple for that:
NumofAdvances = CALCULATE(COUNTX(TRANHIST,TRANHIST[PRIN_ADVANCE]),TRANHIST[PRIN_ADVANCE]<>0)
However, Collections isn't working because money comes in through three sources: "CORRESP", "PAC", and "REGINST"
My measure is:
NumofCollections =
VAR NumofCORRESP = CALCULATE(COUNTX(TRANHIST,TRANHIST[TRAN_SUBTYPE]),TRANHIST[TRAN_SUBTYPE] = "CORRESP")
VAR NumofPAC = CALCULATE(COUNTX(TRANHIST,TRANHIST[TRAN_SUBTYPE]),TRANHIST[TRAN_SUBTYPE] = "PAC")
VAR NumofREGISNT = CALCULATE(COUNTX(TRANHIST,TRANHIST[TRAN_SUBTYPE]),TRANHIST[TRAN_SUBTYPE] = "REGINST")
VAR Total = NumofCORRESP + NumofPAC + NumofREGISNT
RETURN
Total
However, all it returns to me is this:
What am I missing?
Thanks!
Does this also return a blank?
NumofCollections = CALCULATE ( COUNTROWS ( TRANHIST ), TRANHIST[TRAN_SUBTYPE] IN { "CORRESP", "PAC", "REGINST" } )
3 Replies
- AlexisOlsonSuper User
Does this also return a blank?
NumofCollections = CALCULATE ( COUNTROWS ( TRANHIST ), TRANHIST[TRAN_SUBTYPE] IN { "CORRESP", "PAC", "REGINST" } )- bonjourposteHelper V
Yes.
I tried it with COUNTX too:
Collections3 =CALCULATE (COUNTX(TRANHIST,TRANHIST[TRAN_SUBTYPE] ),TRANHIST[TRAN_SUBTYPE] IN { "CORRESP", "PAC", "REGINST" }) - bonjourposteHelper V
Oh thanks so much!! I tried what you wrote again and I just removed some filters I had on the side. Never knew about IN, that is is helpful. Have a great weekend.