Forum Discussion

AndreaSo's avatar
AndreaSo
Frequent Visitor
3 years ago

Measure to not include the same value with different value in column B

Hi

 

I need to write a code to that counts all the distinct text values from column A, with a text value "to monitor" in column B. However, if the value repeats in the column A, one time with text value in column B = "to repair" and another time with = "to monitor", then it should not be calculated in.

1 Reply

  • AndreaSo , Try a measure like

     

    Measure =
    var _cnt =
    FILTER(
    summarize(
    FILTER(
    'Table',
    'Table'[ColumnB] = "to monitor"
    ),
    'Table'[ColumnA]
    ),
    calculate(
    distinctcount('Table'[ColumnB]),
    'Table'[ColumnA] = EARLIER('Table'[ColumnA])
    ) = 1
    )
    return
    countrows(_cnt)