Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
houssamedd
New Member

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:

Capture.PNG

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:

 

Capture expec.PNG

Thank you in advance for your suggestions/answers!

1 ACCEPTED SOLUTION
v-jiascu-msft
Microsoft Employee
Microsoft 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

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-jiascu-msft
Microsoft Employee
Microsoft 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

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Perfect, this worked.

Thank you Dale!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors