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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Harri
New Member

Measrurement for count of rowrs based on text value

Hi,

 

This might be a simple question but I am q bit stuck with it.

 

Data is formatted like this (Table1):

Company; Sales-date
Acme Inc; 01.01.2022
Acme Inc; 02.01.2022
Acme Inc; 03.01.2022
Acme Inc; 04.01.2022
Customer Corp; 05.01.2022
Customer Corp; 06.01.2022
Customer Corp; 07.01.2022
SMB Ltd; 08.01.2022
SMB Ltd; 09.01.2022

 

Company column is a text field and I would like to summarize how many occurences there is for each value. For example, how many sales interactions was there in January for each company.

 

I would expect results like this for given data in report table: Company; number of sales activities:
Acme Inc; 4
Customer Corp; 3
SMB Ltd; 08.01.2022

 

I am adding a measurement like this:
Measure = COUNTROWS(filter(Table1, Table1[Company] = EARLIER(Company)))

 

This provides error:
EARLIER/EARLIEST refers to an earlier row context which doesn't exist.

 

I am doing something wront, but what?

 

Kind Regards,

Harri

1 ACCEPTED SOLUTION
ValtteriN
Super User
Super User

Hi,

COUNT should work for your example. E.g.

Measure 2 = COUNT('Table (8)'[Sales-date])

ValtteriN_0-1697959280985.png

In your measure you used EARLIER. EARLIER should be used in the context of calculated columns.

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/





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

Proud to be a Super User!




View solution in original post

2 REPLIES 2
Harri
New Member

Thank you ValtteriN, this did the job! Much appriciated!

ValtteriN
Super User
Super User

Hi,

COUNT should work for your example. E.g.

Measure 2 = COUNT('Table (8)'[Sales-date])

ValtteriN_0-1697959280985.png

In your measure you used EARLIER. EARLIER should be used in the context of calculated columns.

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/





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

Proud to be a Super User!




Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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

Top Solution Authors