Reputation: 143
I need to expand a large data set (around 90,000 rows) into even more rows, by splitting out each row into the number of rows for each page view.
I'm working in PowerBi and am relatively new to it - so please be explicit.
CURRENT TABLE:
--------------------------------------------------
| Views | Title | Date |
--------------------------------------------------
| 3 | Apples | 12/12/20 |
--------------------------------------------------
WANTED SOLUTION:
--------------------------------------------------
| Views | Title | Date |
--------------------------------------------------
| 1 | Apples | 12/12/20 |
--------------------------------------------------
| 1 | Apples | 12/12/20 |
--------------------------------------------------
| 1 | Apples | 12/12/20 |
Upvotes: 1
Views: 429
Reputation: 16908
Just follow these following steps in power query to achieve your required output. From your sample and output data, I understand you wants to duplicate a row for the values exist in column "views". I am considering this below data as input-
So, according to Views column value, 1st row should be created thrice and the 2nd row for 5 times. Note: Change your Views column data type to Number
Step-1: Add a custom column to your table as shown below-
This will generate a list per row.
Step-2: Expand the list as shown below (right click on the New column)-
You have now data as below-
Step-3: Remove the new column "Custom" from your table.
Step-4: You can replace values from your column Views to 1 if it is a requirement (shown in your sample output)
Finally you should have your required data now.
Upvotes: 1