Forum Discussion

jwb3d's avatar
jwb3d
Frequent Visitor
4 months ago
Solved

DAX command to duplicate rows

Hello, could someone assist me with the DAX commands needed to duplicate rows in a table? The command should reference a column that has a count greater than 1, duplicating the rows according to the count value. Thank you.

  • Hi jwb3d ,

     

    Can you please elaborate a little bit more on the requirements and supply some example?

     

    But based on the overall understanding believe this is better done using Power Query and not DAX, but if you can share the example is easier to give you the correct approach.

3 Replies

  • Hi jwb3d ,

     

    Can you please elaborate a little bit more on the requirements and supply some example?

     

    But based on the overall understanding believe this is better done using Power Query and not DAX, but if you can share the example is easier to give you the correct approach.

    • jwb3d's avatar
      jwb3d
      Frequent Visitor

      I need rows which have count column > 1 to be duplicated by the number of times the count represents. 

      See the image below.

       

       

      • MFelix's avatar
        MFelix
        Super User

        Hi jwb3d 

         

        For this you should use the Power querry because you cannot duplicata tows on a table already loaded só to use dad you would need to create a new table.

         

        On Power query add a column with the followinf code

         

        {1..[Count]}

         

        This Will generate a list of values starting at 1 and ending in the number of the count inside the cell that you can then expand creating a repeted row for each value.

        Then you can delete that new column