Forum Discussion

bernmckin's avatar
bernmckin
Frequent Visitor
6 years ago

How to change default (cross) filter behavior

Hello Community,

I am hoping someone can help with this issue.   The main graph on my report is a bar graph showing the top 6 ranked salespersons.   Surrounding that graph are four other visuals that provide details for whatever bar (salesperson) is chosen from the main graph.   This works exactly as I want when something is chosen from the main graph.  

 

However, if nothing is chosen, the four other visuals default to a summary view, which I do not want.   Instead, I would like the four other visuals to either retain the last salesperson that was selected from the main graph or show the FIRST salesperson from the main graph.  Is there a way to accomplish this?    

 

If the above is not possible, then I would like the main graph to show the top 6 salespersons, but force the user to select one, defaulting to the first one if none is selected.   Can this be done?

 

Thanks for your help.

7 Replies

  • You can add CROSSFILTER() to your context modifiers.  That allows you to change the filter direction for that measure, or ignore the filter altogether for a cross product.

  • andre's avatar
    andre
    Icon for Memorable Member rankMemorable Member

    it is possible by requires some DAX wizardry and it also may not be very intuitive to your users as what you are saying basically is the following, if nothing is selected in Chart One, display other charts as if bar one is selected for Chart One, although nothing in Chart One will indicate that Bar one is selected.  if you still want to do it then this is what you need to do.

     

    let's say your mesaure in other chart is sales.  in that measure you need to check for selectedvalue() of the salesperson, if none is selected, then you need to rank your sales people by sales (assuming that's what is used in Chart One) and then calculcate the rest of the [sales] metric with that sales person id as a filter condition

     

    so you create a SalesPersonID variable first thing in your calc, check selectedvalue(Salesperson...) and if it is not blank, use that ... if the value is blank, which means nothing or more than one is sleceted, then defaul to the first one.. the drawback is it will not be smart when a user selects more than one sales person.  hope this helps

    • bernmckin's avatar
      bernmckin
      Frequent Visitor

      Hi Andre,

      Thank you for your thorough reply.  This is probably a basic question.  After calculating the new measure, SalespersonID, how can I use it as a filter for the other visuals?  

      The other visuals include about 10 different metrics, I'm hoping I don't have to create calculated fields for each.

       

      Thanks again.

      • andre's avatar
        andre
        Icon for Memorable Member rankMemorable Member

        if you are relatively new to DAX then ten measures is what you will need to do, or you can try to create a calculation group using Tabular Editor tool, Calculation groups are really handy if you want to reuse certain logic form many measures, but it requires a little bit more DAX knowledge.  

         

        i have a video on calculation groups that you migh find useful, but right now there are some limitations in them from formatting perspective as well. 

         

        in short, what you are tryint to do is not a typical power bi behavior, so unfortunately, you will need to jump through some DAX hoops to get it to work