Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
Goal: A field that returns the number customers who only have return transactions, a distinct count of Unique_IDs that have only one transaction_type and where that transaction_type=B.
Based on the definition, I think the calculation(s) need to first determine the IDs that have only one transaction type. Of those IDs, determine which have transaction_type=B, and then return the distinct count of remaining IDs. I’m having troubling stringing these steps together to produce the correct population of IDs. Do I need to create a relationship between the summarize table and the transaction table..? Or am I missing a function, or applying them in an order that changes that incorrectly alters the filter context?
This summarize correctly counts transaction types for each ID:
Customers Grouped by Transaction_Type =
SUMMARIZE(
'TRANSACTION',
'TRANSACTION'[Unique_ID],
"Grouped by ID Returns",
DISTINCTCOUNT('TRANSACTION'[Transaction_Type])
)
This field calc produces the count of customers with returns, but does not correctly filter out customers that have returns and purchases.
TEST Returns Only Customers=
CALCULATE(
DISTINCTCOUNT('TRANSACTION'[Unique_ID]),
FILTER(
VALUES (‘Customers Grouped by Transaction_Type’[Unique_ID]),
[Grouped by ID Returns]=1
),
FILTER(
'TRANSACTION',
[Transaction_type]=“B”
)
)
Solved! Go to Solution.
@Anonymous,
You may refer to the measure below.
Measure = COUNTROWS ( FILTER ( VALUES ( 'TRANSACTION'[Unique_ID] ), CALCULATE ( SELECTEDVALUE ( 'TRANSACTION'[Transaction_Type] ) = "B" ) ) )
@Anonymous,
You may refer to the measure below.
Measure = COUNTROWS ( FILTER ( VALUES ( 'TRANSACTION'[Unique_ID] ), CALCULATE ( SELECTEDVALUE ( 'TRANSACTION'[Transaction_Type] ) = "B" ) ) )
Power BI automatically marked the solution as correct. While it may work for someone, it will not work for this case. The suggested syntax incorrectly assumes that each Unique ID corresponds to a single row. However, the data in this case is at the level of Transaction ID, which is more granular than the Unique ID. Since each Unique ID is associated with multiple Transaction IDs, it is not sufficient to use COUNTROWS and it will produce a count that is too high.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
89 | |
85 | |
66 | |
52 | |
31 |
User | Count |
---|---|
121 | |
113 | |
73 | |
65 | |
46 |