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

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

Reply
aiyosap
Helper II
Helper II

How to count a value in column based on grouping (DAX)?

Hi all,

I am trying to create a calculate column using COUNT function to derive the count value of the "Case Number" based on the column of "File Date" grouping. 

For some reason my calculate row derived value as showin in column C (count), but that is incorrect. 

It should be a value like in column D (The Count that I want). How to write such kind of DAX? Thanks.

c1.JPG

Regards,

Aiyo

2 ACCEPTED SOLUTIONS
smpa01
Super User
Super User

@aiyosap 

Measure= calculate (count(tbl[case number]), allexcept(tbl, tbl[case number],tbl[file date]))

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

View solution in original post

Anonymous
Not applicable

Hi  @aiyosap ,

Here are the steps you can follow:

1. Create calculated column.

Count_Column = CALCULATE(COUNT('Table'[Case Number]),FILTER(ALL('Table'),'Table'[File Date]=EARLIER('Table'[File Date])&&'Table'[Case Number]=EARLIER('Table'[Case Number])))

2. Result:

vyangliumsft_0-1642399458661.png

 

Best Regards,

Liu Yang

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

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi  @aiyosap ,

Here are the steps you can follow:

1. Create calculated column.

Count_Column = CALCULATE(COUNT('Table'[Case Number]),FILTER(ALL('Table'),'Table'[File Date]=EARLIER('Table'[File Date])&&'Table'[Case Number]=EARLIER('Table'[Case Number])))

2. Result:

vyangliumsft_0-1642399458661.png

 

Best Regards,

Liu Yang

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

Hi Liu,

 

Why the need for an ALL() in your answer? I tried it in my context without the ALL() and it appears to work. But you had something in mind presumably that I might not be experiencing (yet!) but would like to know what it is.

 

Thanks in advance.

smpa01
Super User
Super User

@aiyosap 

Measure= calculate (count(tbl[case number]), allexcept(tbl, tbl[case number],tbl[file date]))

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.