How to group rows and make columns that count specific values?
Hi!
This is a difficult one to give a title but basically, here is what I am trying to do:
I have a dataset that combines a dataset of user profiles and a dataset of our assets that are assigned to each user. What this does is make it so every single entry for a user's individual assets gets its own row. So basically, if John Smith has a Laptop and a Mobile Phone, he'll have two complete rows like so:
User: John Smith | AssetType: Laptop | DeviceName: John's Mac | etc
User: John Smith | AssetType: Mobile Phone | DeviceName: John's iPhone | etc
What I really want this dataset to be is a high level breakdown of each user, how many assets they have, and how many of each type of asset they have. So theoretically, I'd like it to be something like this:
User: John Smith | Number of Assets: 2 | Number of Laptops: 1 | Number of Mobile Phones: 1
I can see where I can group up the rows by username and get a count of the AssetType, but I'd like to have columns in the dataset that break things down like the above example if possible. What sort of steps would I need to take to do something like that?
Any help is appreciated!
Best Answer
-
Hey JoeR
At a glance I might add 2 filters. 1 that gets asset = phone one that gets asset = laptop then do a group by user to create a new column that counts how many times that user appears in the dataset. This count will be your "total laptop" and "total phone". You could then join back on the user to have 1 row containing both and do a calculation to sum the 2 at the end to get total assets.
Hope this helps!
PT
1
Answers
-
Hey JoeR
At a glance I might add 2 filters. 1 that gets asset = phone one that gets asset = laptop then do a group by user to create a new column that counts how many times that user appears in the dataset. This count will be your "total laptop" and "total phone". You could then join back on the user to have 1 row containing both and do a calculation to sum the 2 at the end to get total assets.
Hope this helps!
PT
1
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 616 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 738 Beast Mode
- 57 App Studio
- 40 Variables
- 685 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 47 Workflows
- 10 DomoAI
- 36 Predict
- 15 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 124 Manage
- 121 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive