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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
swatts5883
New Member

summarize row counts in a new column

I am new to Power BI and I'm having trouble. I want to add a column to a table that totals the number of rows for each distinct value in another column. Thus, this input data in my table:

 

CityName

BOS

DTW

CLE

CLE

BOS

BOS

 

would give me this result:

 

City   Total

BOS  3

CLE   2

DTW  1

 

I have been trying to figure it out and I'm stumped. Thanks in advance.

 

 

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

Create a new column called "Count" and set it equal to 1:

 

Count = 1

 

Create a new MEASURE called "Total" and set it equal to:

 

Total = COUNT([Count])

 

On report canvas, create a table visualization and add CityName and Total to it.

 

 


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

9 REPLIES 9
viveksasi94
Helper I
Helper I

Hello everyone,

 

I'm new to power BI, Please help me out with this. My expected input and output tables are as given below.

INPUT

NumberColumn2
1a
2a
1b
4a
2b
4b
4a
1b

 

OUTPUT

Numberab
112
211
421

 

Thanks in advance,

Vivek

Anonymous
Not applicable

Just found this to be unanswered;

 

1. create a duplicate column of column2

2. select both the column2 and duplicate column2 and click on pivot table option available.

 

this will change the dataset into required format;

 

1.PNG2.PNG

Dash
New Member

Easiest solution.

1.Select table in visualizations

2. Add CityName into Values

3. Add CityName into Values again. Now in the dropdown, change the summarization option from don't summarize to COUNT.

 

Greg_Deckler
Super User
Super User

Create a new column called "Count" and set it equal to 1:

 

Count = 1

 

Create a new MEASURE called "Total" and set it equal to:

 

Total = COUNT([Count])

 

On report canvas, create a table visualization and add CityName and Total to it.

 

 


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

You just solved an issue for me.  Thank you!!

Totally Un-Clear !! How we relate it to the Field ?!

Hi ,

 

I am new to Power BI. Need to show the total count of users, count of distinct users , and count of repeated users for the day.

I am able to get Total count and -6, distinct count -3.  But i need to get the count of repeated users -2  ( Suresh and Mike)

ID Frame        Date                              UserName                

1                     7/1/2016 330 PM         Suresh                   

2                     7/1/2016 330 PM         John3

3                     7/1/2016 337 PM         Mike     

4                     7/1/2016 350 PM         Suresh 

5                     7/1/2016 351 PM         Mike     

6                     7/1/2016 358 PM         Mike                 

Anonymous
Not applicable

Hi swatts5883,

 

   to solve your problem step by step, you have to:

 

1) Select the column

14.png

 

2) Adjust the table using the first row like heading

15.png

 

3) Group By the column "CityName" , choose the new column name , and select the operation "Row count"

 

4) And it's done.

17.png

( . . . )

Let me know if it works.

 

Have a good coding

If you do not want to combine your rows you can add a measure

City total = COUNTA(Sheet1[City])

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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