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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
thedesk
New Member

DAX Totals do not add up with COUNTROWS

Hi there,

 

I am struggling to get totals to add up whereby the cell results are correct.

 

My DAX is below ...

 

=CALCULATE(COUNTROWS(data),FILTER(data,data[Cost]<>MIN(d_Courses[1 course ยฃnet])
&& data[Attend #]>0),FILTER(data,data[Cost]<>MIN(d_Courses[2 course ยฃnet])
&& data[Attend #]>0),FILTER(data,data[Cost]<>MIN(d_Courses[3 courses ยฃnet])
&& data[Attend #]>0))

 

and have also tried variation of... with same results..

 

=COUNTROWS(CALCULATETABLE(data,

FILTER(data,data[Cost]<>MIN(d_Courses[1 course ยฃnet]) && data[Attend #]>0),FILTER(data,data[Cost]<>MIN(d_Courses[2 course ยฃnet]) && data[Attend #]>0),FILTER(data,data[Cost]<>MIN(d_Courses[3 courses ยฃnet]) && data[Attend #]>0)

))

1 ACCEPTED SOLUTION

Many thanks for your help.

I couldnt get the SUMMARIZE to work, however the video link you provided using the IF(HASONEVALUE did work, but only if I created extra measures and wouldnt work if I simply used the expressions that went into the measure.

I have found another way to make this work, swapping the MIN to RELATED. Not sure why this has made it work, but it has ???

 

CALCULATE(COUNTROWS(data),FILTER(data,data[Cost]<>MIN(d_Courses[1 course ยฃnet])
&& data[Attend #]>0),FILTER(data,data[Cost]<>MIN(d_Courses[2 course ยฃnet])
&& data[Attend #]>0),FILTER(data,data[Cost]<>MIN(d_Courses[3 courses ยฃnet])
&& data[Attend #]>0)

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@thedesk , As this includes row level calculation. Based on the visual group by you need to create a measure like

 

Sumx(summarize(Table, Table[COl1], "_1",=CALCULATE(COUNTROWS(data),FILTER(data,data[Cost]<>MIN(d_Courses[1 course ยฃnet])
&& data[Attend #]>0),FILTER(data,data[Cost]<>MIN(d_Courses[2 course ยฃnet])
&& data[Attend #]>0),FILTER(data,data[Cost]<>MIN(d_Courses[3 courses ยฃnet])
&& data[Attend #]>0))),[_1])

 

Col1 is the group by/unsummarized column in visual

 

also check -https://www.youtube.com/watch?v=ufHOOLdi_jk

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Many thanks for your help.

I couldnt get the SUMMARIZE to work, however the video link you provided using the IF(HASONEVALUE did work, but only if I created extra measures and wouldnt work if I simply used the expressions that went into the measure.

I have found another way to make this work, swapping the MIN to RELATED. Not sure why this has made it work, but it has ???

 

CALCULATE(COUNTROWS(data),FILTER(data,data[Cost]<>MIN(d_Courses[1 course ยฃnet])
&& data[Attend #]>0),FILTER(data,data[Cost]<>MIN(d_Courses[2 course ยฃnet])
&& data[Attend #]>0),FILTER(data,data[Cost]<>MIN(d_Courses[3 courses ยฃnet])
&& data[Attend #]>0)

Helpful resources

Announcements
November Fabric Update Carousel

Fabric Monthly Update - November 2025

Check out the November 2025 Fabric 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.

Users online (27)