Forum Discussion

StevenUser123's avatar
StevenUser123
Frequent Visitor
3 years ago
Solved

Using DISTINCT COUNT on a Measure

Hello, I have a measure that calculates quantity based on a calculation of attribute and value (As in, Attribute = QTY and Value = 1), summed as Current Quantity per line item. I am trying to figure...
  • tamerj1's avatar
    3 years ago

    Hi StevenUser123 
    Assuming all columns are coming from one table then you can use

    Distinct Count =
    COUNTROWS (
        FILTER (
            SUMMARIZE (
                'Table',
                'Table'['Table'],
                'Table'[Account Name],
                "@QTY", [Current Quantity]
            ),
            [@QTY] = 0
        )
    )

    In case Product Name and Account ID columns are coming from two different dimension tables then you may use

    Distinct Count =
    COUNTROWS (
        FILTER (
            SUMMARIZE (
                'Sales',
                'Product'['Table'],
                'Customer'[Account Name],
                "@QTY", [Current Quantity]
            ),
            [@QTY] = 0
        )
    )