Forum Discussion
Count based on another column
- 8 years ago
hello misul,
You could try:
Column = CALCULATE( DISTINCTCOUNT(Table1[Route]), ALLEXCEPT(Table1,Table1[Customer]) )
- 8 years ago
ChrisMendoza Correct, the intention is to use DistinctCountofRoutes as a slicer.
When I use the calculated column, the values are summed. So I put the column to "Don't Summarize" and it seems to work now. Thanks!Calculated Column:
Column = CALCULATE( DISTINCTCOUNT(Table1[Route]), ALLEXCEPT(Table1,Table1[Customer]) )
Measure:
Measure= CALCULATE( DISTINCTCOUNT(Table1[Route]), ALLEXCEPT(Table1,Table1[Customer]) )
I realised that the same formula can be used as a measure too. But as measures cannot be used in Slicers. I will stick with Calculated Column (without summarizing it).
Anonymous -
I suppose it depends on what you're trying to accomplish. Reviewing the OP, their need seems different than yours. A calculated column has purpose as well as a measure having it's own purpose.
Column 2 =
CALCULATE(
DISTINCTCOUNT(TableName[Route]),
ALLEXCEPT(TableName,TableName[Customer]),
TableName[Route] <> 4
)
Produces:
However when you represent it in a visual it likely doesn't produce the result you're looking for. I've included a measure so you can see the differences between [Column] / [Column 2] and a [Measure].
Measure =
CALCULATE(
DISTINCTCOUNT(TableName[Route]),
ALLEXCEPT(TableName,TableName[Customer]),
TableName[Route] <> 4
)
Maybe you could post your question in the forum with your desired outcome if my response doesn't solve your issue?
ChrisMendoza , thank you very much! It worked using the formula suggested in a new column. Perfect!!! 🙂