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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
bonjourposte
Helper V
Helper 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.  

bonjourposte_0-1722634256002.png

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:

bonjourposte_1-1722634612736.png

What am I missing?

Thanks!

 

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

Does this also return a blank?

 

NumofCollections =
CALCULATE (
    COUNTROWS ( TRANHIST ),
    TRANHIST[TRAN_SUBTYPE] IN { "CORRESP", "PAC", "REGINST" }
)

View solution in original post

3 REPLIES 3
AlexisOlson
Super User
Super User

Does this also return a blank?

 

NumofCollections =
CALCULATE (
    COUNTROWS ( TRANHIST ),
    TRANHIST[TRAN_SUBTYPE] IN { "CORRESP", "PAC", "REGINST" }
)

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.

Yes.

 

I tried it with COUNTX too:

 

Collections3 =
CALCULATE (
    COUNTX(TRANHIST,TRANHIST[TRAN_SUBTYPE] ),
    TRANHIST[TRAN_SUBTYPE] IN { "CORRESP", "PAC", "REGINST" }
)

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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