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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
iToune
Frequent Visitor

Countrows(Filter) and Calculate(Countrows, Filter) not giving the same results

Hi all,

 

I am trying to add a calculated column to my Table1 to count the number of rows in the Table2 where Table2[vin] = Table1[VIN Num].

At first I wrote this formula:

Formula1 = COUNTROWS(FILTER('Table2','Table2'[vin]=Table1[VIN Num]))+0

 

This worked, but then I needed to add a second criteria so I tried a formula with  Calculate, thinking I would apply two filters. I first tried to just apply the first filter to test it, and wrote this:

Formula2 = CALCULATE(COUNTROWS('Table2'),FILTER('Table2','Table2'[vin]=Table1[VIN Num]))+0

 

From what I understand I should have the same results, but it's not the case. The calculate formula seems to give smaller numbers, but not all the time.

 

Any idea of what is happening ?

Regards

1 ACCEPTED SOLUTION
iToune
Frequent Visitor

OK,

 

so, it semms that the issue xas that there was a relationship (via a third table) between Table1 and Table2. I deleted the relationship and now have correct results.

If anyone has info on how calculate behaves with relationships in calculated column, I'd live to learn more because for now I don't get it.

View solution in original post

5 REPLIES 5
iToune
Frequent Visitor

OK,

 

so, it semms that the issue xas that there was a relationship (via a third table) between Table1 and Table2. I deleted the relationship and now have correct results.

If anyone has info on how calculate behaves with relationships in calculated column, I'd live to learn more because for now I don't get it.

Hi @iToune 

You can try this calculated column,

 

count = CALCULATE(COUNTROWS(Table2),FILTER(ALL(Table2),Table2[vin]=Table1[VIN Num]))

 

vxiaotang_1-1637041903174.pngvxiaotang_0-1637041854241.png

 

 

 

Best Regards,

Community Support Team _Tang

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

iToune
Frequent Visitor

Hi,

 

Thanks @smpa01 for your reply, but it did not work...

I really don't understand what is going on.

@iToune any chance you can provide sample data ?

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
smpa01
Super User
Super User

@iToune  can you try this

Formula2 = CALCULATE(COUNTROWS('Table2'),FILTER('Table2','Table2'[vin]=max(Table1[VIN Num])))+0
Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors