cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jeffgarlisch Regular Visitor
Regular Visitor

Count Values Based on On Category A, On Category B, or Both Categories,

I have a data set that looks like so 

dc.JPG

 

 

 

Merchant ID column contains repeated values for a specific merchant

Transaction ID contains unique values for each transaction

Credit Debit Column Flags whether the transaction is a Credit or a Debit

 

 

I'm wondering if there is DAX i could use to calculate the Counts pictured above. 

 

Count of Merchant doing ONLY Debit transactions

Count of Merchant doing ONLY Credit transactions

Count of Merchant doing BOTH Debit & Credit transactions

Count of All Merchants

 

 

This is what I have so far, its a hard value to verify manually querying the database, and I have a feeling the formulas are incorrect!

 

Counts Total Merchants:

TotalMerchants = DISTINCTCOUNT(DST_TGO[MID])

Counts Total Debit Merchants:

TotalDebitMerchants = CALCULATE(DISTINCTCOUNT(DST_TGO[MID]),CreditDebitCode[IsDebit] = 1)

Counts Total Credit Merchants

TotalCreditMerchants = 
CALCULATE(DISTINCTCOUNT(DST_TGO[MID]),CreditDebitCode[IsDebit] = 0)

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Count Values Based on On Category A, On Category B, or Both Categories,

Hi@ jeffgarlisch

You need to improve your measure and do them more deeply

Count Combo = [TotalCreditMerchants]+[TotalDebitMerchants]-[TotalMerchants] 
Count Credit = [TotalMerchants]- [TotalDebitMerchants]
Count Debit = [TotalMerchants]- [TotalCreditMerchants]

Result:

4.png

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Community Support Team
Community Support Team

Re: Count Values Based on On Category A, On Category B, or Both Categories,

Hi@ jeffgarlisch

You need to improve your measure and do them more deeply

Count Combo = [TotalCreditMerchants]+[TotalDebitMerchants]-[TotalMerchants] 
Count Credit = [TotalMerchants]- [TotalDebitMerchants]
Count Debit = [TotalMerchants]- [TotalCreditMerchants]

Result:

4.png

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

jeffgarlisch Regular Visitor
Regular Visitor

Re: Count Values Based on On Category A, On Category B, or Both Categories,

Thanks so much! I dont know why I didnt thinkof that, I must've been too close to the problem! 

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 61 members 1,390 guests
Please welcome our newest community members: