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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Need Help on Countifs functionality

Hi Everyone,

 

A very quick and easy question. I just wanted to count the number of rows/entity based on different column. Its pretty easy in excel but I am unable to find the way in PowerBI.

Below is the outout and input which I have calcualted using excel..

 

NameClassCount
UpharMaths4
UpharMaths4
UpharMaths4
UpharMaths4
UpharScience2
UpharScience2
ShubhamScience5
ShubhamScience5
ShubhamScience5
ShubhamScience5
ShubhamScience5
ShubhamHistory2
ShubhamHistory2
UpharComputer1

 

Here, I just wanted to calculate how many times a subject is coming for a particular name and wanted the same in count column.

 

Excel Formula is = COUNTIFS($B$3:$B$16,B3,$C$3:$C$16,C3)

 

Created a measure but it is not working.. 

 

#Total count check =
CALCULATE (
COUNTROWS ( BU_SUBBU_Mapping),
FILTER (
Table1,
Table1[Name] = Table1[Name] ]
&& Table1[Subject] = Table1[Subject]
)
)
 
Please help..
 
Regards
Uphar
1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@Anonymous - So you could create a column or measure like:

Measure = 
  VAR __Name = MAX([Name])
  VAR __Class = MAX([Class])
RETURN
  COUNTROWS(FILTER(ALL('Table'),[Name]=__Name && [Class]=__Class))

Column = 
  VAR __Name = [Name]
  VAR __Class = [Class]
RETURN
  COUNTROWS(FILTER('Table',[Name]=__Name && [Class]=__Class))

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

@Anonymous - So you could create a column or measure like:

Measure = 
  VAR __Name = MAX([Name])
  VAR __Class = MAX([Class])
RETURN
  COUNTROWS(FILTER(ALL('Table'),[Name]=__Name && [Class]=__Class))

Column = 
  VAR __Name = [Name]
  VAR __Class = [Class]
RETURN
  COUNTROWS(FILTER('Table',[Name]=__Name && [Class]=__Class))

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hi @Greg_Deckler ,

 

Thank you so much, I have created a calculated column and its working perfectly.

 

Kudos to you! Thank you for the quick support.

 

Regards

Uphar

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.