Filling Blank rows with previous non-null value from the same column
Raw Data :
Product Values
A | |
---|---|
23 | |
24 | |
25 | |
B | |
45 | |
56 | |
76 | |
C | |
34 | |
D | |
55 |
Expected Output :
Product Values
A | |
---|---|
A | 23 |
A | 24 |
A | 25 |
B | |
B | 45 |
B | 56 |
B | 76 |
C | |
C | 34 |
D | |
D | 55 |
Here i am trying to fill blank rows with the previous non-null value in same column and i want to accomplish above scenario in MagicETL, any help will be highly appreciated.
Thanks in advance.
Best Answer
-
Without seeing a dataset or column values, I have to generalize and create some fake data. Let's say I have two tables represented here by webforms. The one one the left contains headers or something representing the titles or bigger things. The right being the detailed raw data. If I am joining the data, there needs to be a common field. In this case I use Chapter to join up with the Product Group.
Depending upon how I join these, I get something like this.
It's hard to tell where the header is and whether the continuing detail rows are. How can we find the first row in each chapter? One way is to use Rank and Window in the ETL. By adding a rank, I can denote which lines are the header and which are details.
Using that rank (called myrank in my example), I can create a calculated field. Let's call it vHeading. Whenever the rank is 1, I know its a heading. So I want to show my heading. When the rank is something else, I may want blank space under my heading. I call this nesting.
Case WHENmyrank
=1 thenHeadings
else '' end
When I apply it to the data, I get something like the following. If I want my headings on every line, I simply put it on the chart. If I want them only to appear in the first entry line, I can use the calculated field.Note that I can create a calculated field using rank, without putting rank on the card. You'll notice also that my first heading has a space to the right. Look back at the details data and you'll see I have an entry with no index value. I may want that, or I may want to filter blanks and nulls out.
Hopefully this gives you enough information to solve the issue.
** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0
Answers
-
Without seeing a dataset or column values, I have to generalize and create some fake data. Let's say I have two tables represented here by webforms. The one one the left contains headers or something representing the titles or bigger things. The right being the detailed raw data. If I am joining the data, there needs to be a common field. In this case I use Chapter to join up with the Product Group.
Depending upon how I join these, I get something like this.
It's hard to tell where the header is and whether the continuing detail rows are. How can we find the first row in each chapter? One way is to use Rank and Window in the ETL. By adding a rank, I can denote which lines are the header and which are details.
Using that rank (called myrank in my example), I can create a calculated field. Let's call it vHeading. Whenever the rank is 1, I know its a heading. So I want to show my heading. When the rank is something else, I may want blank space under my heading. I call this nesting.
Case WHENmyrank
=1 thenHeadings
else '' end
When I apply it to the data, I get something like the following. If I want my headings on every line, I simply put it on the chart. If I want them only to appear in the first entry line, I can use the calculated field.Note that I can create a calculated field using rank, without putting rank on the card. You'll notice also that my first heading has a space to the right. Look back at the details data and you'll see I have an entry with no index value. I may want that, or I may want to filter blanks and nulls out.
Hopefully this gives you enough information to solve the issue.
** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **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
- 754 Beast Mode
- 61 App Studio
- 41 Variables
- 693 Automate
- 178 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