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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
win_anthony
Resolver III
Resolver III

Distinct Transaction Count with Same or Different Person

The goal is to be able to count the number of transactions made by a manager regardless the number of assistants. Below is sample data which along with expected (correct) output + current (incorrect) output. Any advice/support is greatly appreciated. Example scenario: if you were a pizza shop owner and want to know how many deliveries your drivers made, it doesn't matter the numbers of pizza's for each order. You just want to know how many times the drivers went to make the delivery. This is where I am having a hard time. 

 

Below is the current measure that is giving me the incorrect output

 

 

var tempCaseCount = COUNT( Table[CASE_ID] )

RETURN

CALCULATE(
    tempCaseCount
    ,FILTER(
        Table
        ,Table[Manager]
    )
)

 

 

Sample Data: 

Case_IDAssistantManager
1JessSam
1MarySam
2JessMike
2JessKen

Expected (Correct) Output: Notice Sam is the sole manager but had 2 assistants. The goal is to count Sam once (1)

ManagerCase_ID_Count
Sam1
Mike1
Ken1
Total3

Current (Incorrect) Output: Notice Sam is counted for 2 but should only be counted once (1)

ManagerCase_ID_Count
Sam2
Mike1
Ken1
Total4
1 ACCEPTED SOLUTION
v-tianyich-msft
Community Support
Community Support

Hi @win_anthony ,

 

I made simple samples and you can check the results below:

vtianyichmsft_0-1709877519132.png

Measure = CALCULATE(DISTINCTCOUNT('Table'[Case_ID]),ALLEXCEPT('Table','Table'[Manager]))

 

An attachment for your reference. Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

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

4 REPLIES 4
v-tianyich-msft
Community Support
Community Support

Hi @win_anthony ,

 

I made simple samples and you can check the results below:

vtianyichmsft_0-1709877519132.png

Measure = CALCULATE(DISTINCTCOUNT('Table'[Case_ID]),ALLEXCEPT('Table','Table'[Manager]))

 

An attachment for your reference. Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

ExcelMonke
Super User
Super User

Have you tried using Distinctcount instead of Count?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





@ExcelMonke thank you for your response. Yes I have tried DistinctCount but the results was not expected. Below is the result of using Distinct Count. I am assuming that using Distinct Count is only counting the distinct case id's and disregarding the number of managers. 

Any other thoughts? 

ManagerCase_ID_Count
Sam1
Mike1
Ken1
Total2

Based purely off of the above sample data, consider the following measure:

Measure = 

VAR _CaseCount =
    DISTINCTCOUNT ( Sheet1[Case_ID] )
VAR _Table =
    SUMMARIZE ( Sheet1, Sheet1[Manager], "CaseCount", _CaseCount )
RETURN
    CALCULATE ( COUNTX ( _Table, [CaseCount] ) )

 

I get the following result:

ExcelMonke_0-1709835717478.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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