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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Dynamically Create Column For Each Item In Order

Hello,

Looking to create a custom table based on another table.

 

I have a table called "order_id_product" which has order_id and the product information.

 

The two fields in question are:

order_id

product_title

 

I want to create another table, say "basket_analysis" which takes the order_id and then dynamically creates a column for each item in the order. I have seen DAX solutions which do 2 columns but I was expecting PQ to be better for this and also have better dynamic ability.

 

Expected outcome would look something like this:

 

order_idproduct_1product_2product_3product_4product_5
12345title_1title_2   
12346title_1title_2title_3  
12347title_1    
12348title_1title_2title_3title_4title_5

 

Would anyone be able to assist on this as I have zero PQ knowledge.

 

Huge thank you in advance!

1 ACCEPTED SOLUTION

Have a look at https://www.daxpatterns.com/basket-analysis/ . DAX Patterns is by the SQLBI guys, they're awesome.

View solution in original post

3 REPLIES 3
johnt75
Super User
Super User

Can I ask what you are trying to achieve by this? It would seem like this would only make any calculations you want to do in a report much more complicated as you don't know which column a product will appear in for any given order. Perhaps there are other approaches which can give your desired outcome.

Anonymous
Not applicable

Hi,

 

I do agree and being new to Pbi, I am trying to find ways to conduct analysis like basket analysis. I was thinking I could use the table for product basket analysis.

 

I'm still searching far and wide for the best method to do this and appreciate your reply showcasing concerns.

Have a look at https://www.daxpatterns.com/basket-analysis/ . DAX Patterns is by the SQLBI guys, they're awesome.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.