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
faustusxanthis
Frequent Visitor

Need help summarizing row count

Hello!


It seems I'm out of options and I can't seem to find the right solution. 

My data is like this: 

DatePersonCount Instance
1/1/2024Person 12
1/1/2024Person 12
1/1/2024Person 21
2/5/2024Person 11
2/7/2024Person 21
2/5/2024Person 31
9/1/2024Person 41
10/6/2024Person 22
10/6/2024Person 22


The data for Date and Person are already present. I just need to create a DAX expression for a column (Count Instance)that calculates the instance of the combination of Date and Person (eg: Person 2 with date 10/6/2024 appeared 2 times, therefore the count should be 2). 

I tried to use SUMMARIZE but it's giving me error "The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value."



2 ACCEPTED SOLUTIONS
Ashish_Mathur
Super User
Super User

Hi,

This calculated column formula works

Column = CALCULATE(COUNTROWS(Data),FILTER(Data,Data[Date]=EARLIER(Data[Date])&&Data[Person]=EARLIER(Data[Person])))

Hope this helps.

Ashish_Mathur_0-1728172779126.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

Here is a better version

 

Count Instance =
CALCULATE (
    COUNTROWS ( Data ),
    TREATAS ( { ( [Date], [Person] ) }, Data[Date], Data[Person] )
)
 
Not using EARLIER (which is discouraged anyway) or variables.

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

This calculated column formula works

Column = CALCULATE(COUNTROWS(Data),FILTER(Data,Data[Date]=EARLIER(Data[Date])&&Data[Person]=EARLIER(Data[Person])))

Hope this helps.

Ashish_Mathur_0-1728172779126.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Here is a better version

 

Count Instance =
CALCULATE (
    COUNTROWS ( Data ),
    TREATAS ( { ( [Date], [Person] ) }, Data[Date], Data[Person] )
)
 
Not using EARLIER (which is discouraged anyway) or variables.
lbendlin
Super User
Super User

No need to use DAX. The implicit measures can do that for you. Power BI automatically aggregates.

 

lbendlin_0-1728085442190.png

 

Hi @lbendlin

Yeah I know I can do that but I need it to show as another column in Data view. 

lbendlin_0-1728171474224.png

 

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.