Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
bernmckin
Frequent Visitor

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 7
andre
Memorable Member
Memorable 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

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.

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

 

Thanks Andre,

Before I jump into the calculation groups, are there any alternatives, such as using FIRST like is done for a card?  Or, forcing a selection from the main graph?

Hi @bernmckin ,

 

This can be achieved.

Do you mind sharing your .pbix file?

Or report screenshots and sample data.

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@bernmckin , can you make it a single select slicer?

lbendlin
Super User
Super User

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.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.