Do I need to use Beast Mode to filter data in this way?

I'm working on a sales dashboard and I've got a scenario where within a card I need to filter out pitches sent to internal staff unless they are tagged with a specific word (of 10 possibles) contained in a measure.

 

Is Beast Mode the solution and if so how would I do it? Any help much appreciated.

 

Cheers,

 

Danny

Comments

  • guitarhero23
    guitarhero23 Contributor

    Yes a beast mode should work out for that, I would also recommend adding that new calculated field to the filter and checking the "Quick Filters" box so that you can filter or unfilter it while on the card.

     

    An option would be to use a case statement, something like

     

    (CASE

    WHEN `tag` = 'Internal tag #1' THEN 'Internal'

    WHEN `tag` = 'Internal tag #2' THEN 'Internal'

    WHEN `tag` = 'Internal tag #3' THEN 'Internal'

    ........etc

     

    Else 'External'

    END)

     

    When you to it this way you could filter easily between internal and external (or show both). Let me know if you have any other questions or if you need help writing it provide me the column name and the 10 possible values you want to be able to filter out as internal and I'll write it up.



    **Make sure to like any users posts that helped you and accept the ones who solved your issue.**
  • I agree with @guitarhero23  that this can be handled by a beastmode, and the case statement he provided should do the job.  I also like the suggestion to use the quickfilter so you can choose to include or exclude the filter easily.

     

    However, my suggestion would be to make this kind of field within the dataflow.  Beastmode calculations thrive when the calculation itself changes based on what other metadata you want to filter out, or at whiat level you are aggregating the data.  But, in my opinion, if you are engineering a field that will classify each line of code (in this case each "pitch" id) as either internal or external, then I would write that into the dataflow itself.  Especially if this classification is going to be looked at repeatedly.  

     

    The advantage to engineering the field in a dataflow is that it then becomes easier to create other beastmodes with it.  For example, if you wanted to calculate the percentage of internal sales pitches you could simply use this if the field was constructed in the dataflow:

    count(distinct case when `pitch type` = 'internal' then `pitch_id` end) / count(distinct `pitch_id`)

    However, if you used a beastmode...

    count(distinct
    case when
    (CASE
    WHEN `tag` = 'Internal tag #1' THEN 'Internal'
    WHEN `tag` = 'Internal tag #2' THEN 'Internal'
    WHEN `tag` = 'Internal tag #3' THEN 'Internal'
    ........etc
    Else 'External'
    END) = 'Internal' then `pitch_id` end)
    /
    count(distinct `pitch_id`)

    Plus, if you change one of your `tag`s then you would need to change the filter beastmode as well as any other calculations you used the beastmode in.  By applying the engineering for the classification field in the dataflow, you only need to change the dataflow if you decide to change how you are defining an internal pitch.


    “There is a superhero in all of us, we just need the courage to put on the cape.” -Superman
  • guitarhero23
    guitarhero23 Contributor

    @DannyLewis Were you able to get this running as you wanted?



    **Make sure to like any users posts that helped you and accept the ones who solved your issue.**