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
Thomas_S
Frequent Visitor

Count calculation result

Hello

 

I'm trying to count the result of a calculated measure but i'm stucked...

 

I have 2 distinct tables (with many other differents columns, extracted from 2 differents "tools"), looking like that (simplified version) :

 

Table 1 : 

id      Amount

1       5

2       10

3       8

 

Table 2 :

id      Amount

1       5

2       2

3       8

 

From that, 3 calculated measure :

- based on table 1, SUM(amount) by id (let's call it "sum1")

- based on table 2, SUM(amount) by id (let's call it "sum2")

- based on the 2 previous measure, a "sum3" =  "sum2" - "sum1"

 

The final results by id is :

id      Amount

1       0

2       -8

3       0

 

From that, i'm trying to count the number of time where the result is = 0 (2 times in my case).

 

How can I obtain this result ?

1 ACCEPTED SOLUTION

Hi,

Try this measure

Measure = COUNTROWS(FILTER(VALUES(Calendrier[Date]),[Solde]==0))

or

Measure = COUNTROWS(FILTER(VALUES(Calendrier[Date]),[Solde]=0&&[Solde]<>blank()))


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi,

Drag this measure to a card visual

Measure = countrows(FILTER(VALUES(Allid[id]),[Sum3]=0))

Ensure that you create a seperate table called Allid which has all unique ID's.  Create a relationship (Many to One and Single) of both your data tables to the Allid table.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks, we're close to the result !

 

With this measure : 

Measure = COUNTROWS(FILTER(VALUES(Calendrier[Date]),[Solde]=0))
 
I got this result :

Capture d’écran 2023-02-17 101119.jpg

 

 

 

Which is close to correct. 

 

In my model, the measure's result I try to test is based on a calendar table (need to count the number of days where "solde" = 0). And in this exemple, from range 03/01 to 08/01, there are 6 days. In this filtered selection, the "solde"= 0 is checked the 06/01. But there are no data the 04/01, so, since the day exist in my calendar, I guess the measure consider the "solde"=0 on this particuliar day. And finally count 2 instead of 1.

 

What condition / filter can I add to ignore days where there are no datas ?

Hi,

Try this measure

Measure = COUNTROWS(FILTER(VALUES(Calendrier[Date]),[Solde]==0))

or

Measure = COUNTROWS(FILTER(VALUES(Calendrier[Date]),[Solde]=0&&[Solde]<>blank()))


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

The first one works perfectly ! Thank you !

(the second measure return "empty" on the card)

 

Last question, for my understanding, why is it working with a double "=" sign in the measure? What does it mean ?

You are welcome.  Read here - DAX operators - DAX | Microsoft Learn


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-zhangti
Community Support
Community Support

Hi, @Thomas_S 

 

Measure:

 

Count = COUNTX(FILTER('Table 1',[Sum3]=0),[Sum3])

Or

Count = COUNTX(FILTER('Table 1',[Sum3]=0),[ID])

 

vzhangti_0-1676598828763.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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
Top Kudoed Authors