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.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