Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
Rate
Helper III
Helper III

Help with creating new Rows from previous rows in same table

Hello!

 

I am having trouble with generating new rows in my table. I have a table with a line for each product we are selling (Bread, Milk and Salt). As the Bread comes with a gift, I would want to generate a new row for every Bread sold, replicating the same information as in the said row, but changing the product sold (Gift in this case).

 

Original Table:

questionnarie_response_line_idgift_product_idgift_product_namegift_product_qtycreated
8222Bread1017/06/2019 9:04
9432Bread1017/06/2019 10:22
13972Bread318/06/2019 9:42
13896Milk518/06/2019 9:37
6596Milk2814/06/2019 17:15
3525Salt1814/06/2019 9:14
3835Salt514/06/2019 9:41

 

Desired table:

questionnarie_response_line_idgift_product_idgift_product_namegift_product_qtycreated
8222Bread1017/06/2019 9:04
9432Bread1017/06/2019 10:22
13972Bread318/06/2019 9:42
13896Milk518/06/2019 9:37
6596Milk2814/06/2019 17:15
3525Salt1814/06/2019 9:14
3835Salt514/06/2019 9:41
82299Gift1017/06/2019 9:04
94399GIft1017/06/2019 10:22
139799Gift318/06/2019 9:42

 

Do you have any idea as to how I could achieve this?

 

Thanks a lot!

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

Hello @Rate 

Give this a try

Union Table = 
UNION(
    SUMMARIZE('Table','Table'[questionnarie_response_line_id],'Table'[gift_product_qty],'Table'[created],'Table'[gift_product_id],'Table'[gift_product_name]),
    SUMMARIZE(
        CALCULATETABLE(
            'Table',
            'Table'[gift_product_name] = "Bread"
        ),
        'Table'[questionnarie_response_line_id],
        'Table'[gift_product_qty],
        'Table'[created],
        "gift_product_id",VALUE("99"),
        "gift_product_name","Gift"
    )
)

View solution in original post

2 REPLIES 2
jdbuchanan71
Super User
Super User

Hello @Rate 

Give this a try

Union Table = 
UNION(
    SUMMARIZE('Table','Table'[questionnarie_response_line_id],'Table'[gift_product_qty],'Table'[created],'Table'[gift_product_id],'Table'[gift_product_name]),
    SUMMARIZE(
        CALCULATETABLE(
            'Table',
            'Table'[gift_product_name] = "Bread"
        ),
        'Table'[questionnarie_response_line_id],
        'Table'[gift_product_qty],
        'Table'[created],
        "gift_product_id",VALUE("99"),
        "gift_product_name","Gift"
    )
)

Hello @jdbuchanan71 

 

Wow, just WOW. Thanks so much. That worked like a Charm!

 

Really grateful!! You just made my day.

 

Thanks a lot and have an amazing day.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.