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
empoweredbi
Regular Visitor

Counts for several fields in a single table

All of my variables are strings. I want to summarize/tally the number of times that every type of string occurs, for every column/field, for every row in my data set. 

 

Given this input data:

 

regionunitIDrentalStatusmanager
Chicago1AvailableJohn
Chicago2RentedJohn
Miami3AvailableSally
Miami4AvailableSally
Miami5RentedSusan

 

How would I achieve the following summary output in a single table? 

 

FieldDimensionCount
regionChicago2
regionMiami3
unitID11
unitID21
unitID31
unitID41
unitID51
rentalStatusAvailable3
rentalStatusRented2
managerJohn2
managerSally2
managerSusan1

 

1 ACCEPTED SOLUTION
Syk
Super User
Super User

You can select all your columns in Power Query editor and under the transform tab hit unpivot columns. This will give you the Attribute and Value columns you're looking for.

You can then create a merged column to get all of your combinations into one column and in Power BI desktop count your merged column.

Syk_0-1661279479465.png



Just a note.. This seems pretty odd, what is your use case? Maybe we can come up with a better solution for you.



View solution in original post

2 REPLIES 2
Syk
Super User
Super User

You can select all your columns in Power Query editor and under the transform tab hit unpivot columns. This will give you the Attribute and Value columns you're looking for.

You can then create a merged column to get all of your combinations into one column and in Power BI desktop count your merged column.

Syk_0-1661279479465.png



Just a note.. This seems pretty odd, what is your use case? Maybe we can come up with a better solution for you.



Thank you for the suggestion, Syk, I'll give it a try.

 

Our use case is the development of several dashboards that will help validate the integrity of data in multiple systems. We have many critical tables that are updated multiple times a year by dozens of employees and it's common for one or more employees to etiher fail to enter important data or to enter incorrect data. Therefore, one of the goals of our validation dashboards will be to pull in every important variable and compare the distribution of dimensions (e.g. how many rental units are in Chicago, how many rental units are available, etc.) to prior data snapshots, in order to get a sense of whether or not the data looks comparable to historical records or whether there are significant deviations. By simply showing the frequency/counts of each dimension in each field, we believe we can get a good sense of the integrity of the data. For instance, if we suddenly see that there are no records for Chicago - or perhaps that every single unit is marked as Available - we can try to track down where the data has gone missing/bad. 

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.