Forum Discussion
Anonymous
5 years agoNot applicable
Creating a new column that counts values from another column
I want to create new columns from values from one column in power bi. How do I do that? Let's say for instance from the table below, I want to create new columns for different states from the state column that will count the number of companies that are headquartred in that state, how will I do that in power bi
| Company Id | Company Name | States | Alabama | Texas | Illinois | Michigan | Ohio |
| 1 | Xtech | Alabama | 2 | 4 | 1 | 2 | 3 |
| 2 | Coliq | Texas | |||||
| 3 | Fimtec | Illinois | |||||
| 4 | Witnog | Michigan | |||||
| 5 | Gnamew | Ohio | |||||
| 6 | Zenith | Texas | |||||
| 7 | Lever | Michigan | |||||
| 9 | Gum | Texas | |||||
| 10 | Hunlec | Ohio | |||||
| 11 | Girthlow | Ohio | |||||
| 12 | Tetlow | Alabama | |||||
| 13 | Doughlas | Texas |
1 Reply
- Jihwan_Kim
Super User
New Table =
ROW (
"Alabama", COUNTROWS ( FILTER ( Data, Data[States] = "Alabama" ) ),
"Texas", COUNTROWS ( FILTER ( Data, Data[States] = "Texas" ) ),
"Illinois", COUNTROWS ( FILTER ( Data, Data[States] = "Illinois" ) ),
"Michigan", COUNTROWS ( FILTER ( Data, Data[States] = "Michigan" ) ),
"Ohio", COUNTROWS ( FILTER ( Data, Data[States] = "Ohio" ) )
)https://www.dropbox.com/s/lr6vx7fu3fv8m1j/joparaugo.pbix?dl=0