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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
hackfifi
Helper V
Helper V

Create Duplicate Entries based on Column Value

Good Day - I have a table in PowerBI Query as DATA [shown below]

I am trying to convert that DATA to OUTPUT [shown below]

In summary, Each ROW needs to be duplicated based on COUNT value, and ID Column needs to be added for that set of duplicate data.

 

Appreciate any help to make this possible!

 

Duplicate Query.PNG

1 ACCEPTED SOLUTION
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @hackfifi

 

You could try this calculated table in DAX

 

Table 2 = 
    GENERATE(
        'Table',
         FILTER(
             SELECTCOLUMNS(
                 GENERATESERIES(1,100),
                 "ID",[Value]
                 ),
                 [ID]<=[Count])
                 )

This gave me this result

 

 

image.png


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

7 REPLIES 7
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @hackfifi

 

You could try this calculated table in DAX

 

Table 2 = 
    GENERATE(
        'Table',
         FILTER(
             SELECTCOLUMNS(
                 GENERATESERIES(1,100),
                 "ID",[Value]
                 ),
                 [ID]<=[Count])
                 )

This gave me this result

 

 

image.png


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

I need to do the same thing but in Power Query. Any idea how?

@Phil_Seamark - Mate you never fail to disappoint!

Couple of Queries:

1. Using the Generate Table function, i assume now i cannot accesss the new generated table via Query Editor to make some changes?

2. I am trying to understand your formular - what does "GenerateSeries(1,100) do?

Thanks again!

Hi @hackfifi

 

The GenerateSeries function just creates a single column table with values between 1 and 100

 

if you create a new calculated table and use just that function you will see what it looks like.

 

I wrapped it with the SELECTCOLUMNS function, simply to rename the column as you already had a column called [Value] in your first column.


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Ok @Phil_Seamark - So i am doing SOMETHING wrong. Obviously the below the "REAL" data, not the SAMPLE table i provided earlier. As you can see each row has count value of "19" in this case. Hence  the generated table should show each row 19 times i.e. it should have 57 rows of data

 

Duplicate Query2.PNG

 

 

Hi @hackfifi

 

Make sure the data type of your [Count] column is set to int.  Try that...


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Yes the "Count" column on Main Table is of Type "Whole Number"....
Maybe i will import the data and start again

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.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

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.