cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

basket analysis

HI, I need help with the following dax.

 

I have a table (store name, date, customer ID, bought item , price etc...)

To do a basket analysis, I created a second table with following DAX:

 

Filter ( Crossjoin ( Values ( 'POS' [Item]), Selectcolumns ( Values ( 'POS' [Item]), "Item2", [Item] )), [Item] > [Item] )

 

This works fine, but I would like to add, [store name] and [ year-month] .

 

How can I modify the above Dax that it will contain these two columns?

 

Thanks for your help

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User IX
Super User IX

Re: basket analysis

@nabe ,

You can have like this

Filter ( Crossjoin ( Values ( 'POS' [Item]), Selectcolumns ( 'POS', "Item2", [Item], "store name" , [store name]," year-month",[ year-month] )), [Item] > [Item] )

 

 

Cross join do not take same column name, select columns is used to restrict /rename columns

 

You can take full tables too.

crossjoin(table1,Table2)

both can have selectcolumns



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

2 REPLIES 2
Super User IX
Super User IX

Re: basket analysis

@nabe ,

You can have like this

Filter ( Crossjoin ( Values ( 'POS' [Item]), Selectcolumns ( 'POS', "Item2", [Item], "store name" , [store name]," year-month",[ year-month] )), [Item] > [Item] )

 

 

Cross join do not take same column name, select columns is used to restrict /rename columns

 

You can take full tables too.

crossjoin(table1,Table2)

both can have selectcolumns



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

Highlighted
Helper II
Helper II

Re: basket analysis

@amitchandakunderstood. Thanks for your explanation. This worked perfectly

Helpful resources

Announcements
Ignite

Microsoft Ignite

This will be a conference that you do not want to miss!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Don't miss the Power BI Dev Camp this week!

August Community Highlights

Check out a full recap of the month!

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power BI

Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.