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
gracie494
Helper I
Helper I

Dax - Count in Column based on a specific field

Hello, How do I perform a count of the Cons group in each specific reporting unit. The output I am trying to achieve is in green:

gracie494_0-1628515374187.png

 

1 ACCEPTED SOLUTION

@gracie494 

pls add all(), and have a try on below DAX.

calculate(distinctcount[consgroup],filter(ALL(table),[reportingunit]=max([reportingunit]))





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

9 REPLIES 9
ryan_mayu
Super User
Super User

@gracie494 

maybe try

calculate(distinctcount[consgroup],filter(table,[reportingunit]=max([reportingunit]))





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@ryan_mayu sadly it didnt work, just returns a 1

gracie494_0-1628519245489.png

 

@gracie494 

pls add all(), and have a try on below DAX.

calculate(distinctcount[consgroup],filter(ALL(table),[reportingunit]=max([reportingunit]))





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@ryan_mayu Thank you so much, it worked. 🙂

 

you are welcome





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Greg_Deckler
Community Champion
Community Champion

@gracie494 Perhaps:

Measure =
  VAR __RU = MAX('Table'[Reporting Unit])
  VAR __CG = MAX('Table'[ConsGroup])
RETURN
  COUNTROWS(FILTER(ALL('Table'),[Reporting Unit]=__RU && [ConsGroup]=__CG))


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...

@Greg_Deckler Thanks Greg, sadly it did'nt work. Below is the result

 

gracie494_0-1628517228450.png

 

amitchandak
Super User
Super User

@gracie494 , Try

a New column

= calculate(distinctcount(Table[ConsGroup]), filter(Table, [ reporting unit] =earlier([ reporting unit])))

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

@amitchandak Thanks, though sadly it didnt work

gracie494_1-1628517372496.png

 

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