cancel
Showing results for
Did you mean:
New Member

## count common value for columns and rows

Hi everyone,

After hours of arguing with ChatGpt, sudden blurry vision and probably acute OCD due to errors showing up with my formula, Im finaly here.

All I want is to display the count of products with the same DCI for each combination of labs, even if the labs are different ( all what I managed to do is to display it only when the lab is the same, if my boss sees it ... 😏)

Well that's it, Im counting on any charitable soul here, thanks in advance 🙏🏻

PS: the actual formula:

CommonProducts =
CALCULATE(
COUNTROWS(db),
ALLEXCEPT(db, db[Lab], db[DCI])
)

1 ACCEPTED SOLUTION
Community Support

Hi  @Aida_Ken ,

I created some data:

Here are the steps you can follow：

1. Create calculated table.

``````Table =
var _table1=
DISTINCT('db'[Lab])
var _table2=
DISTINCT('db'[Lab - Copy])
return
CROSSJOIN(
_table1,_table2)``````

2. Create calculated column.

``````Column =
COUNTX(
FILTER(ALL('db'),
'db'[Lab]=EARLIER('Table'[Lab])),[the actual formula:CommonProducts])``````

3. Result:

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Community Support

Hi  @Aida_Ken ,

I created some data:

Here are the steps you can follow：

1. Create calculated table.

``````Table =
var _table1=
DISTINCT('db'[Lab])
var _table2=
DISTINCT('db'[Lab - Copy])
return
CROSSJOIN(
_table1,_table2)``````

2. Create calculated column.

``````Column =
COUNTX(
FILTER(ALL('db'),
'db'[Lab]=EARLIER('Table'[Lab])),[the actual formula:CommonProducts])``````

3. Result:

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Announcements

#### Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

#### Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

#### Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

#### Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors
Top Kudoed Authors