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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Luque
Frequent Visitor

Duplicate row by value

Hello everyone, 

I need help with the process to duplicate a row by the value on one specific column. 

 

I have this table (example) :

Screen.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I need that if the Value 3 is "PS02" or "PS03", it should create a new row with the same values but Value 1 = Value 2  and Value 3 = blank.

 

 

Thanks in advance.

 

Regards.

1 ACCEPTED SOLUTION

Hi @Luque,

 

2.PNG

Based on above sample dataset, please create a calculated table with below DAX.

Table_2 =
VAR tempTable =
    FILTER (
        Table_1,
        Table_1[Cancelation reason] = "PS-002"
            || Table_1[Cancelation reason] = "PS-003"
    )
RETURN
    UNION (
        Table_1,
        SELECTCOLUMNS (
            tempTable,
            "No", [No],
            "Due Date", [Document Date],
            "Document Date", [Document Date],
            "Cancelation reason", BLANK (),
            "Amount", [Amount]
        )
    )

3.PNG1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Ruksuro
Helper III
Helper III

Why are you trying to duplicate rows, what is the end goal here?

 

If you are trying to double count the rows then maybe a calculated column would help, such as (psuedocode):

 

If Value 3 is "PS02" or "PS03 then 2 else 1

 

and then sum the new column as a measure?

Luque
Frequent Visitor

Hi Ruksuro, thanks for the reply.

 

I need to duplicate rows because in my report i need to show the same row in a matrix but in different dates at same time, and just in specific situations.

 

I have to do that because in the source data (SQL Server from Microsoft Dynamics Nav 2009), the row i have to show is being updating instead of creating a new one, so i have to duplicate it.

 

Its like that:

Captura.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Thanks again, and i hope i explained myself.

Hi @Luque,

 

2.PNG

Based on above sample dataset, please create a calculated table with below DAX.

Table_2 =
VAR tempTable =
    FILTER (
        Table_1,
        Table_1[Cancelation reason] = "PS-002"
            || Table_1[Cancelation reason] = "PS-003"
    )
RETURN
    UNION (
        Table_1,
        SELECTCOLUMNS (
            tempTable,
            "No", [No],
            "Due Date", [Document Date],
            "Document Date", [Document Date],
            "Cancelation reason", BLANK (),
            "Amount", [Amount]
        )
    )

3.PNG1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you so much!

 

Its exactly what i need. 

 

Regards!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.