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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Aida_Ken
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])
)

 

20230604_194715.jpg

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Aida_Ken ,

I created some data:

vyangliumsft_0-1686027548415.png

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])

vyangliumsft_1-1686027548417.png

3. Result:

vyangliumsft_2-1686027587733.png

 

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

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi  @Aida_Ken ,

I created some data:

vyangliumsft_0-1686027548415.png

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])

vyangliumsft_1-1686027548417.png

3. Result:

vyangliumsft_2-1686027587733.png

 

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

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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