How can i write this sql statement in domo?
where a.Customer NOT IN(select distinct Customer from CustomerSalesData where InvoiceDate < '2020-07-01')
Statement below is a column I use for an sql query..
ROW_NUMBER() over(partition by a.Customer order by MIN(a.InvoiceDate)) as OrderNum
I am getting an error while trying to convert this statement. I am not sure how to convert it into something that Domo will understand.
Can this be done in beast mode or MagicETL?
Thanks for any help.
Comments
-
For you first statement, you can split out your data and perform a number of functions with tiles and then join it back together. Something like this:
Your filter tile would filter to the invoice date that you want. The Group By tile would give you distinct list by just choosing customer as your column and then do some sort of aggregation, such as count. Then join it back to your original dataset and choose left join with your original dataset being on the left. After the join, use another filter tile to filter where a column from the right table is null. This would give you your customers not in your subquery.
Your second one, you can use the Rank and Window tile to do the row number. I would suggest looking at this kb article if you haven't looked at it yet.
https://domohelp.domo.com/hc/en-us/articles/360044876094-New-Magic-ETL-Tiles-Aggregate#3.
**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.1 -
Thanks Mark.
I was able to use the Rank and File tile to get some of the data that I needed. I will try splitting and joining the data in MagicETL.
0 -
What if my invoice date keeps changing? I collect data for this by month so I keep changing the invoice date that I look back at.
0 -
@vikrao what's the business question you're trying to answer in plain english?
i suspect it's something like "which users havent paid an invoice in the last x months.
if so rework your filter as a formula based off CURRENT_DATE
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 -
sorry for late reply. I am trying to find 'first orders from customers who have requested samples from us in the past'
0 -
To explain more precisely,
If I have 100 sample requests in January, I want to find out how many of those customers who requested samples converted to first orders in the next 15 days, 30 days, 45 days.
0 -
uh...
would it be fair to say you want to rank orders by date ascending, and just want to know the date_diff of the first order and today?
do your rank() function in ETL and then do your datediff in Beast Mode.
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 -
Yes, that would be fair to say. I will try it out and update this thread if I can get it to work.
0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 102 SQL DataFlows
- 626 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 753 Beast Mode
- 61 App Studio
- 41 Variables
- 692 Automate
- 177 Apps
- 456 APIs & Domo Developer
- 49 Workflows
- 10 DomoAI
- 38 Predict
- 16 Jupyter Workspaces
- 22 R & Python Tiles
- 398 Distribute
- 115 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 130 Manage
- 127 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 11 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 110 Community Announcements
- 4.8K Archive