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
Anonymous
Not applicable

Create a new table based on specific row column data

Please help! We are trying to pull individual row/column data from a dataset and put those rows into a new table

1) Get a listing of data from the original dataset (this data represents two joined tables) 

2) Refine the output from step 1 to flatten it as shown below in the image:

pairodice_0-1736266109822.png

3) Create a new table with Step 2 data and filter out any that do not have 'x' in each row/column  as shown below:

pairodice_2-1736266353569.png

4) get rid of empty rows... 

 

 

 

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi @Anonymous ,

I create a table as you mentioned.

vyilongmsft_0-1736314476279.png

Then I think you can go to Power Query and you can use Advanced Editor.

vyilongmsft_1-1736314549325.png

let
    Source = Table.FromRecords({
        [Number="A", A=null, B=1, C=1, D=null],
        [Number="B", A=1, B=null, C=1, D=null],
        [Number="C", A=1, B=1, C=null, D=null],
        [Number="D", A=null, B=null, C=null, D=null]
    }),
    Unpivoted = Table.UnpivotOtherColumns(Source, {"Number"}, "Attribute", "Value"),
    Filtered = Table.SelectRows(Unpivoted, each [Value] = 1),
    Grouped = Table.Group(Filtered, {"Number"}, {{"Value", each Text.Combine(List.Transform([Attribute], Text.From), ","), type text}})
in
    Grouped

So you can get what you want.

vyilongmsft_2-1736314823092.png

 

 

Best Regards

Yilong Zhou

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

@Anonymous - The example provided by @Anonymous  was just that. The source step contains a static data table that recreates the data supplied in your screenshot. 

 

You need to replace the code in the source step with a connection to your csv file, this should give you a start on that: https://goanalyticsbi.com/how-to-connect-to-csv-data-in-power-bi-desktop/

 

Then you need to make the code supplied matches the first column name in your CSV. If your first column is called Number it will work fine, if not, you need to make sure you change "Number" in the steps that begin with Unpivoted = and Grouped =

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @Anonymous ,

I create a table as you mentioned.

vyilongmsft_0-1736314476279.png

Then I think you can go to Power Query and you can use Advanced Editor.

vyilongmsft_1-1736314549325.png

let
    Source = Table.FromRecords({
        [Number="A", A=null, B=1, C=1, D=null],
        [Number="B", A=1, B=null, C=1, D=null],
        [Number="C", A=1, B=1, C=null, D=null],
        [Number="D", A=null, B=null, C=null, D=null]
    }),
    Unpivoted = Table.UnpivotOtherColumns(Source, {"Number"}, "Attribute", "Value"),
    Filtered = Table.SelectRows(Unpivoted, each [Value] = 1),
    Grouped = Table.Group(Filtered, {"Number"}, {{"Value", each Text.Combine(List.Transform([Attribute], Text.From), ","), type text}})
in
    Grouped

So you can get what you want.

vyilongmsft_2-1736314823092.png

 

 

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Thank you so much Yilong!  This is closer to what we are trying to get but the numbers change (based on the csv sheet that is incoming) and there are nearly 50 columns and hundreds of rows in the data. How would I make this more dynamic please? Can some sort of IF or Switch be used to test the values in each row/column combination? 

@Anonymous - The example provided by @Anonymous  was just that. The source step contains a static data table that recreates the data supplied in your screenshot. 

 

You need to replace the code in the source step with a connection to your csv file, this should give you a start on that: https://goanalyticsbi.com/how-to-connect-to-csv-data-in-power-bi-desktop/

 

Then you need to make the code supplied matches the first column name in your CSV. If your first column is called Number it will work fine, if not, you need to make sure you change "Number" in the steps that begin with Unpivoted = and Grouped =

mark_endicott
Super User
Super User

@Anonymous - This isn't a problem for DAX to fix. This is best off done in Power Query. 

 

I suggest you reveiw this video as there is likely to be some guidance as to how you can solve this challenge easily:

 

https://www.youtube.com/watch?v=HAfpyY2OvZQ

 

If this helps, please accept as the solution so others with the same challenge can find the answer. 

Anonymous
Not applicable

That video does not help - he is only truncating tables together.  We need to create a new table based on the 'x' showing up in row/column combination as shown in the pictures... 

@Anonymous - I was just trying to show you some of the techniques you would need to use, so you couldlear. Maybe I used the wrong video. 

 

@Anonymous has given you a great solution, so go with that. 

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.