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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.