Data Comparison in a DOMO Dataset
I have a dataset which stores daily snapshots of data. It is set in append mode, so it captures daily run of that dataset . My requirement is to compare the data between current date and the user input date(which will be older than today's date) and see which are new records / updated etc.
Data is as below:
So latest date is 8th Oct (MM-DD-YY) . If user wants to compare it with 8th oct, he should get that CCCCC order number has been added as new and ship date for XXXXXYY has been changed.
How do i achieve this in DOMO?
SNAPSHOT DATE | ORDER NUMBER | SHIP DATE |
---|---|---|
10-08-23 | XXXXYYY | 11-08-23 |
10-08-23 | ZZZYSS | 12-08-23 |
10-08-23 | CCCCC | 10-08-23 |
08-08-23 | XXXXYYY | 12-08-23 |
08-08-23 | ZZZYSS | 12-08-23 |
07-08-23 | ABC | 01-01-24 |
07-08-23 | DEF | 03-04-24 |
Best Answer
-
First you shouldn't partition on
Snapshot Date
, you should partition byCSO_Number
, as you care about how each Order has changed over time between snapshots, and your Order by should be theSnapshot Date
Ascending, so you'll always get the value for that Order on the previous day. Not sure where theSNAPSHOT_DT_FOR_LAG
is coming from.Once you have this, you can compare whether the previous value is the same as the current, if so call it
static
else if the previous value was null call itnew
and if it changed thenchanged
that way for each Order you can show the number of times it was changed or created in the period (you filter your table to ignore thestatic
entries).Lag_CSO
can still come in handy if for some reason people are able to enter Orders in the system without a Shipping date, or can blank out the date afterwards.0
Answers
-
I'd recommend passing your dataset through a Magic ETL and utilize a Rand & Window tile with the LAG function. You can get the prior record for each order_number ordered by the snapshot date. Then filter your new lag ship date field where it doesn't match the original ship date. This will return records which didn't get updated. Then you're left with a dataset with the snapshot date and all of the orders which have changed or are new.
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**0 -
@GrantSmith The problem is that user can input any value from the past dates. Its not that he is just comparing previous snapshot with current.
0 -
The lag would show you when a value changed then when they're filtering between the two dates it'll show all the values that changed not just the prior date.
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**0 -
What should be the offset in that case? If I choose 1, wont it give only prior date data? Problem is user can enter any past value and lets say he choose 1st Oct, then it should show records updated /entered new between 1st and Current dat
0 -
If you're looking at total changes in the given period there are a couple of questions on how you'd address the same record being affected on during the window, examples, assuming Oct 1st as the selected date:
- An order gets created on 10/1/2023 with a ship date of 10/7/2023 and on 10/6/2023 the ship date gets updated to 10/12/2023.
- An order gets updated on 10/4/2023 to a ship date of 10/17/2023 and updated again on 10/8/2023 to a ship date of 10/10/2023.
These are still a single Orders, but they got "affected" multiple times in the window you're looking at. With @GrantSmith approach you could show the number of times a record has the "Change Type" update or New in the period and display those with a pivot table, just by adding a calculated column that tells by comparing the previous and current values if it is new, updated or the same.
0 -
Hello @marcel_luthi . The user will input a date - I have to do a comparison between that date and the current date in the dataset. With @GrantSmith offset=1, how will i achieve it since LAG will show only previous record. Please suggest.
0 -
With the LAG offset = 1 it will return the prior value. You then filter where the lag value and the current value has changed. This will show you when a record has changed.
Once it's filtered you now have a list of all the orders that were either created or updated and the dates associated with those orders. You users can then filter this new dataset based on the date to determine which records are new or updated in between the dates they selected.
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**0 -
@GrantSmith Below is how I am trying to do it. CSO is Order Number. It is still not giving me expected values. :( . Please see output as well. Now if user selects 2nd Oct , it should show that Ship date has been changed after that. I have no where to show this in resultset.
Output:
0 -
First you shouldn't partition on
Snapshot Date
, you should partition byCSO_Number
, as you care about how each Order has changed over time between snapshots, and your Order by should be theSnapshot Date
Ascending, so you'll always get the value for that Order on the previous day. Not sure where theSNAPSHOT_DT_FOR_LAG
is coming from.Once you have this, you can compare whether the previous value is the same as the current, if so call it
static
else if the previous value was null call itnew
and if it changed thenchanged
that way for each Order you can show the number of times it was changed or created in the period (you filter your table to ignore thestatic
entries).Lag_CSO
can still come in handy if for some reason people are able to enter Orders in the system without a Shipping date, or can blank out the date afterwards.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
- 56 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