Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Count distinct values in one column, grouped by another column

I'm quite new to Power BI and I think this is probably very easy, but I've been trying to work out a solution for several days an I can't work it out.   My data consists of a top-level category (un...
  • Pragati11's avatar
    3 years ago

    HI Anonymous ,

     

    You can create a calculated column in Power BI using the following DAX measure:

    Count of Type by Make = // calculated column to get count of Type by Make
    CALCULATE(
        COUNT('Model Data'[Type]), // counting the Type
        FILTER(
            'Model Data', // filtering the table to get the count of type groupoed by Make
            'Model Data'[Make] = EARLIER('Model Data'[Make])
        )
    )

    You will get the result as follows:

    Hope this helps.