Forum Discussion
Create Duplicate Defect Entries based on Column Value
Greetings,
I am attempting to utilize a Calculated New Table to create duplicate entries based on the count column. The 'table' I am referencing is called 'Defect Count'.
I also would like for an additional column that tracks the iteration of the defect. I have provided an example below.
Example:
Original Data Table 'Defect Count'
| Defect | Count |
| Too Short | 3 |
| Bump | 1 |
| Brittle Blade | 2 |
Disered Result
| Defect | Count | Iteration |
| Too Short | 3 | 1 |
| Too Short | 3 | 2 |
| Too Short | 3 | 3 |
| Rust | 1 | 1 |
| Brittle | 1 | 1 |
Bump | 2 | 1 |
| Bump | 2 | 2 |
| Rust | 4 | 2 |
| Rust | 4 | 3 |
| Rust | 4 | 4 |
| Rust | 4 | 5 |
You can copy the solution here in PowerQuery, which I recommend over trying to do the same thing in DAX - https://community.fabric.microsoft.com/t5/Desktop/Table-TransformColumns-repeat-rows-n-times-and-add-a-new-column/m-p/818837/highlight/true#M393542
- Anonymous2 years ago
Hi carlin93
Based on your needs, I have created the following table.
Create a new custom column by using the following code in power query:
= List.Numbers(1, [value])Then click "Expand to New Rows".
Click "Close and Apply".
This is the result you want.
Best Regards,
Jayleny
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 Replies
- vicky_Super User
You can copy the solution here in PowerQuery, which I recommend over trying to do the same thing in DAX - https://community.fabric.microsoft.com/t5/Desktop/Table-TransformColumns-repeat-rows-n-times-and-add-a-new-column/m-p/818837/highlight/true#M393542
- carlin93New Member
Thank you! This helped a lot
- AnonymousNot applicable
Hi carlin93
Based on your needs, I have created the following table.
Create a new custom column by using the following code in power query:
= List.Numbers(1, [value])Then click "Expand to New Rows".
Click "Close and Apply".
This is the result you want.
Best Regards,
Jayleny
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- carlin93New Member
Thank you, this also helped me as well