Forum Discussion

houssamedd's avatar
houssamedd
New Member
7 years ago
Solved

DISTINCT COUNT AND GROUP BY

Good morning Power BI community!

I have been running through some problems creating the correct measure, and I'm wondering if you guys can help.

 

I have a table that goes like this:

I created a measure which is a count distinct of books per writer per publishing house.

Now, what I would like to do is to create a measure which is a distinct count of books per publishing house and have both the measures in the same table.

The desired table is the following:

 

Thank you in advance for your suggestions/answers!

  • Hi houssamedd,

     

    Try this formula, please. BTW, the first need doesn't need a measure. Try the built-in calculation.

    Measure =
    CALCULATE (
        DISTINCTCOUNT ( Table1[Book] ),
        ALLEXCEPT ( Table1, Table1[publishing house] )
    )
    

    DISTINCT-COUNT-AND-GROUP-BY

    Best Regards,
    Dale

2 Replies

  • v-jiascu-msft's avatar
    v-jiascu-msft
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi houssamedd,

     

    Try this formula, please. BTW, the first need doesn't need a measure. Try the built-in calculation.

    Measure =
    CALCULATE (
        DISTINCTCOUNT ( Table1[Book] ),
        ALLEXCEPT ( Table1, Table1[publishing house] )
    )
    

    DISTINCT-COUNT-AND-GROUP-BY

    Best Regards,
    Dale