Grouping by client_id without losing row data
I have a table of client purchases with columns:
- sale date
- client ID
- sale total
I'd like to group by client ID so that I end up with total sales for each client however when I do that in the data flow, I lose all date information for the sale.
When I use a date formula to pull out sale year and include that in my grouping, I'm able to separate out each client's sales by year, but the data is rigid and I'm unable to group by month in my cards without modifying the data flow and adding a new output.
Is grouping by client ID possible in a beast mode? When I try to use a case statement I need to say case when client_id = X
however I'd like that X
to continue to change for ALL client IDs. As a result I'd need a new case statement for every client_id
which seems crazy.
What am I missing?
Best Answer
-
if you want to calculate livetime value.
In ETL you can GROUP BY Client ID and sum(Amount) then JOIN that back onto the transactions.
OR you can use a RANK & WINDOW function to calculate cumulative Sum (so you know lifetime value at the time the transaction took place).
Or do the same thing in DataSet Views using window functions and avoid ETL altogether.
Jae Wilson
Check out my 🎥 Domo Training YouTube Channel 👨💻
**Say "Thanks" by clicking the ❤️ in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"1
Answers
-
You shouldn't need to do any ETL or beast mode work for this. If using a table card, for example, drag in all 3 columns into your column listing. Click the pencil next to sales total and choose aggregation of Sum. In the date range filter, choose group by year. This should give you the sales totals for each client for each year.
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.0 -
what question are you trying to answer in your card?
there's no reason to group your data in ETL if in analyzer all you want to do is show sales grouped by client, just toss the client on the X-axis and sum(sale total) on the y-axis.
Jae Wilson
Check out my 🎥 Domo Training YouTube Channel 👨💻
**Say "Thanks" by clicking the ❤️ in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"0 -
My apologies. I thought I had provided sufficient information in my question, but I did not :/ . I am trying to calculate customer lifetime value and there are additional columns I want to be able to group on as well such as the office the client visits.
I'm not looking to actually include the client's ID in the final card. If I use a pivot chart card and include sale year as my rows and office as my columns, it displays the office's total sales and not the avg. client's total sales.
Does that make any sense?
0 -
if you want to calculate livetime value.
In ETL you can GROUP BY Client ID and sum(Amount) then JOIN that back onto the transactions.
OR you can use a RANK & WINDOW function to calculate cumulative Sum (so you know lifetime value at the time the transaction took place).
Or do the same thing in DataSet Views using window functions and avoid ETL altogether.
Jae Wilson
Check out my 🎥 Domo Training YouTube Channel 👨💻
**Say "Thanks" by clicking the ❤️ in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"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