Forum Discussion
gregtm
2 years agoNew Member
Count Rows in a column based on another column's distinct value
I want to total the Buyers in column B based on the PO in column A. Example 1 PO = 3 buyers (Total column) I have tried a couple of measures Distinctcount and Count but can't seem to get it. P...
- 2 years ago
A measure like this should work:
Buyer Count per PO = CALCULATE( DISTINCTCOUNT( [Buyer] ) , ALLSELECTED( {Buyer] ) )The reason for writing the measure this way is in your above example, you want the total number of buyers per PO within a table containing both PO and Buyer, so you need to remove the row context of Buyer from the calculation. This is what the ALLSELECTED here is doing.
CoreyP
2 years agoSolution Sage
A measure like this should work:
Buyer Count per PO = CALCULATE( DISTINCTCOUNT( [Buyer] ) , ALLSELECTED( {Buyer] ) )
The reason for writing the measure this way is in your above example, you want the total number of buyers per PO within a table containing both PO and Buyer, so you need to remove the row context of Buyer from the calculation. This is what the ALLSELECTED here is doing.
gregtm
2 years agoNew Member
Thank you very much. That works perfectly.