Pivoting data in data flows (Year over year || week over week)

Hi,
I have account information on one of my data sets like this:
- Registrations:
Name Date_of_Registration
Daniel 2015-12-01
John 2015-10-22
Peter 2014-12-01
I want to use dataflows in order to pivot this data in two ways:
#1 New registrations per year
- 2014 2015
1 2
#2 New registrations per week
- Week 2014 2015
10 0 1
12 1 1
To solve this I've used a mysql that does this (mysql doesn't have a pivot function):
- select
sum(case when YEAR (date_of_registration) = 2014 then 1 else 0 end ) Year_2014
sum(case when YEAR (date_of_registration) = 2015 then 1 else 0 end ) Year_2015
from registrations
this works fine for yearly data, however for weekly data I was planning to do something like this:
- select
sum(case when WEEK (registration_date) = 30 AND YEAR (registration_date) = 2014 then 1 else 0 end ) Week30_Year2014
sum(case when WEEK (registration_date) = 30 AND YEAR (registration_date) = 2015 then 1 else 0 end ) Week30_Year2015
from registrations
The query above would be fine for showing only two specific weeks, however I would like to have 2010 to 2015 and I don't want to add a sum per week per year.
Is there a better way to do this? Any help is grealy appreciated.
Best Answer
-
I Just realized this is solved with a simple group by
sorry, too long working on that flow
2
Answers
-
I Just realized this is solved with a simple group by
sorry, too long working on that flow
2 -
No need to apologize; sometimes you just need to work through the process of what you are doing.
"When I have money, I buy books. When I have no money, I buy food." - Erasmus of Rotterdam0
Categories
- All Categories
- 2K Product Ideas
- 2K Ideas Exchange
- 1.6K Connect
- 1.3K Connectors
- 311 Workbench
- 7 Cloud Amplifier
- 9 Federated
- 3.8K Transform
- 655 Datasets
- 114 SQL DataFlows
- 2.2K Magic ETL
- 811 Beast Mode
- 3.3K Visualize
- 2.5K Charting
- 80 App Studio
- 45 Variables
- 770 Automate
- 190 Apps
- 481 APIs & Domo Developer
- 76 Workflows
- 23 Code Engine
- 36 AI and Machine Learning
- 19 AI Chat
- AI Playground
- AI Projects and Models
- 17 Jupyter Workspaces
- 408 Distribute
- 119 Domo Everywhere
- 279 Scheduled Reports
- 10 Software Integrations
- 142 Manage
- 138 Governance & Security
- 8 Domo Community Gallery
- 48 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 114 Community Announcements
- 4.8K Archive