Forum Discussion

newgirl's avatar
newgirl
Post Patron
4 years ago
Solved

Distinct Count per Group

Hi! I have a raw data of transactions of our clients, in which some clients belong to the same group which is why there's a column representing their grouping. Ex. Group 1 is an individual client whi...
  • HotChilli's avatar
    4 years ago

    OK, I've created a column:

     

    AllNoinGroupMinPoints = var _Group = Sales[Group]
    var _rowsInGroup = COUNTROWS(FILTER(Sales, Sales[Group] = _Group))
    var _rowsInGroupWithNo = COUNTROWS(FILTER(Sales, Sales[Group] = _Group && Sales[Minimum Points] = "No"))
    RETURN
    IF(_rowsInGroup = _rowsInGroupWithNo, 1, 0)
     
    and then a measure to use the column:
    F_MinPTest = CALCULATE( DISTINCTCOUNT(Sales[Group]), Sales[AllNoinGroupMinPoints] = 1)
     

    Please test at your side.