MS PowerBI - Excluding certains rows

520 Views Asked by At

I need to create a measure (DirectQuery mode) in order to calculate the number of rows that have the same values for the field [OriginType] excluding the ones that comes from the same parents. Following an example:

Parents

  • Parent: A
  • Parent: B
  • Parent: C

Details

  • Id: 1, Parent: A, OriginType: Italy
  • Id: 2, Parent: B, OriginType: Italy
  • Id: 3, Parent: C, OriginType: Italy
  • Id: 4, Parent: B, OriginType: Italy

My representation would be:

  • Parent A, Value: 3
  • Parent B: Value: 2
  • Parent C: Value 3

So, I need to exclude in the calculation for each parents, the details who had the same parents. How can achieve that using PowerBI Dax?

1

There are 1 best solutions below

5
On BEST ANSWER
MyMeasure :=
VAR ThisParent =
    MIN( Table1[Parent] )
RETURN
    COUNTROWS( FILTER( ALL( Table1 ), Table1[Parent] <> ThisParent ) )