1 Reply Latest reply on Oct 11, 2019 9:12 AM by Nasim Afzali Chali

    Filtering Data and NaN values in column

    Brandon Thomson

      Hey all,

       

      I'm trying to incorporate forecasting (using the fbprophet package) into a Tableau dashboard, but am coming across several errors. To do this, I mostly followed the presentation by Nathan Mannheimer (https://www.youtube.com/watch?v=nRtOMTnBz_Yhttp://)

       

      For context, the dataset I have features aggregated marketing data across several different data sources (6) and clients (28). As you can imagine, each data source has different min/max dates, and there are gaps in data when a client is not marketing on these channels for those dates.

       

      Here is the script I'm running to return forecasted data (measure name = "Forecast"), based on a period to forecast parameter, and a dynamic KPI selector:

       

      [Forecast]

      Screen Shot 2019-09-11 at 3.26.16 PM.png

      Here is the date formula I'm using to populate [Dates] (I copied what Nathan did in his presentation):

       

      [Dates]

      Screen Shot 2019-09-11 at 3.26.48 PM.png

       

      I can only get this to run on account/channel combinations if every row has represented data. In this case, Paid Search across all clients is the only way to yield a result. See the table and chart below:

      Screen Shot 2019-09-11 at 3.18.34 PM.png

      forecast_example.png

      If I select a different channel, or filter by client, I receive the following error:

      Screen Shot 2019-09-11 at 3.10.26 PM.png

       

      And furthermore, if I try to drop rows that feature null values (df.dropna(subset=['ds'])), then I receive this error:

      Screen Shot 2019-09-11 at 3.21.06 PM.png

       

      So - it looks like the script is wanting to pull all data from the dataset, and if I filter the data in Tableau, it is receiving an error because it's keeping the dataframe the same size and filling in Null values. If I try to drop those null values, then the list result differs from what Tableau expects, and it wont accept. Is there anything I can change in my calculations that will account for the level of detail I need? Ideally, I would like to create this where I can filter by any dimension in my dataset, and this script will run.

       

      Unfortunately, I am unable to share a workbook since it contains sensitive information.

       

      Let me know,

      Brandon