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.7K Product Ideas
- 1.7K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 292 Workbench
- 4 Cloud Amplifier
- 8 Federated
- 2.8K Transform
- 95 SQL DataFlows
- 603 Datasets
- 2.1K Magic ETL
- 3.7K Visualize
- 2.4K Charting
- 697 Beast Mode
- 43 App Studio
- 39 Variables
- 658 Automate
- 170 Apps
- 441 APIs & Domo Developer
- 42 Workflows
- 5 DomoAI
- 32 Predict
- 12 Jupyter Workspaces
- 20 R & Python Tiles
- 388 Distribute
- 111 Domo Everywhere
- 271 Scheduled Reports
- 6 Software Integrations
- 113 Manage
- 110 Governance & Security
- 9 Domo University
- 30 Product Releases
- Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 98 Community Announcements
- Domo Community Gallery
- 4.8K Archive