Forum Discussion

NickFournogerak's avatar
NickFournogerak
Frequent Visitor
2 years ago
Solved

Connection PowerBI with Python Script for Association Rules

Hello,

 

I have a dataframe in PowerBI and I want to conduct Market Basket Analysis(Association Rules) on it, with a Python Script and then present the results through PowerBI.

 

However, some of the input variables should be defined from the user (e.g. Customer Type, Time Period etc). These input parameters, would be the ones that would initialize the python script that would run in the background on the fly.

 

The results woud be then presented in PowerBI, with a table,graph etc.

Sounds like this is something possible?

 

  • AmiraBedh's avatar
    AmiraBedh
    2 years ago

     the input variables should be defined from the user (e.g. Customer Type, Time Period etc) :

    this info needs to be in the dataset. In other words, you can create slicers in Power BI for user input, such as Customer Type, Time Period. These slicers can be linked to your data so that it's filtered based on the user's choice.

7 Replies

  • It wouldn't let me share either a .pbix file or upload a .csv file, so I copied and pasted the information that is included in the dataframe.

     

    ACCOUNT_IDBEGINTIMETime_PeriodGAME_GROUP_IDNEW_OLD_GAME
    11254162311/8/23191928Old Game
    11554380217/8/23131928Old Game
    11337440818/8/23121928Old Game
    11516002018/8/23121928Old Game
    11391207919/8/23111928Old Game
    11546978320/8/23101928Old Game
    10931861321/8/2391928Old Game
    10949832521/8/2391928Old Game
    11193645323/8/2371928Old Game
    11583155823/8/2371928Old Game
    11036565624/8/2361928Old Game
    10949832525/8/2351928Old Game
    1120226485/6/23861366Old Game
    7033128/6/23631366Old Game
    11241458311/7/23501366Old Game
    11045771513/8/23171366Old Game
    1102167087/8/23237677New Game
    10993574124/7/23373500Old Game
    11658263817/7/23446386Old Game
    11026171919/6/23727257Old Game
    • AmiraBedh's avatar
      AmiraBedh
      Super User

       the input variables should be defined from the user (e.g. Customer Type, Time Period etc) :

      this info needs to be in the dataset. In other words, you can create slicers in Power BI for user input, such as Customer Type, Time Period. These slicers can be linked to your data so that it's filtered based on the user's choice.

      • NickFournogerak's avatar
        NickFournogerak
        Frequent Visitor

        Ok. Let's stay for example at the time period that exists in the dataframe.

        I have a slicer in powerbi from which user can make a selection.

        The question is, how I can return this value as a parameter to the python script and make the script run with this variable?

         

         

  • The input dataframe is similar to below.

    What I want is to run the market basket analysis with/without New Games because in many cases they skew my results. Or also to be able to include/exclude low value customers.

     

    These parameters should be inserted as input from the user, passed as parameter to python script in the background in order to run the market basket analysis algorithm and then return the results.

    • AmiraBedh's avatar
      AmiraBedh
      Super User

      Can you please provide your dataframe as text not a picture ? or a model in a pbix file ?