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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Generating rows of data based on count in column

I have data on two different granularity levels:

1. One result per one row, for example

Category   Result
Cat1          1
Cat1          3
Cat1          5
Cat2          3
Cat2          4

2. Data for previous periods, where the detail has been lost, for the same data it would look like this

Category  Count  Average
Cat1         3          3
Cat2         2          3.5


To make an interactive report where all the data is included I would prefer to generate dummy rows from the aggregated data, that is

Category   Result
Cat1          3
Cat1          3
Cat1          3
Cat2          3.5
Cat2          3.5

Preferrably this step should take place in Power Query, so that I could append the two datasets. Any ideas on how to proceed?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I see. So back in your second table, you can add a custom column with the following code:

{ 1..[Count]}

That will produce a list starting at 1 to whatever the # in count is. You can go ahead and expand that out

List Column.png

Append with table one, and you get this table 

Append Table.png

 

Only interested in Category, Result and Average, so can remove all the other columns. 

 

Then just merge the Result and Average columns and you the following table:

Final Table.png

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

You can merge queries as new.  

Merge Queries as new.png

then just expand out the average column

Expand Out Merge.png

Anonymous
Not applicable

Let me update the question. The categories in the aggregated table might match the ones in the data table, but they might also be different.

data.PNG


aggregated.PNG

 

In this case the Merge + expand action suggested gives me:

merge.PNG

or if I expand all the columns then:

expand.PNG

What I actually need to achieve is
desired.PNG

Anonymous
Not applicable

I see. So back in your second table, you can add a custom column with the following code:

{ 1..[Count]}

That will produce a list starting at 1 to whatever the # in count is. You can go ahead and expand that out

List Column.png

Append with table one, and you get this table 

Append Table.png

 

Only interested in Category, Result and Average, so can remove all the other columns. 

 

Then just merge the Result and Average columns and you the following table:

Final Table.png

 

Anonymous
Not applicable

Perfect, thank you!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.