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

Questions about selection filter in power bi

Hello everyone, my question and a current problem is how can I select a specific customer in the graph and it correctly returns my top 5, the top 5 only works correctly when I perform the filtering through a specific filter, which in this case is typing the customer's name , but I would like if just by selecting the customer the data would adjust, for the other graphs it works properly, except for the top 5.

 

jeanbinhozouza_0-1708347215973.png

Field 1 - Manual Filter.

Field 2 - Bar chart that you would like, once selected, to properly filter the top 5.

Field 3 - Top 5.

1 ACCEPTED SOLUTION
123abc
Community Champion
Community Champion

You can use DAX measures combined with slicers or filters. Here's a general approach you can follow:

  1. Create a Measure for the Top 5 Customers: You need to create a DAX measure that calculates the relevant metric for your customers and returns the top 5 based on the selection.

  2. Use a Slicer or Filter for Customer Selection: Ensure you have a slicer or filter visual on your report page that allows users to select a specific customer.

  3. Apply the Measure to Your Visual: Apply the DAX measure you created in step 1 to the visual that displays the top 5 customers. This visual could be a table or a bar chart, depending on your preference.

Here's a sample DAX measure that calculates the metric (let's call it "Metric") and returns the top 5 customers based on the selected customer:

 

Top 5 Customers =
VAR SelectedCustomer = SELECTEDVALUE('Customer'[CustomerName])
RETURN
TOPN(5,
FILTER(ALL('Customer'),
'Customer'[CustomerName] = SelectedCustomer
),
[Metric], DESC
)

 

Replace 'Customer'[CustomerName] with the actual column reference to your customer names, and [Metric] with the actual metric you're measuring (e.g., sales, revenue, etc.).

Once you have the measure in place, you can apply it to your visual representing the top 5 customers. When a specific customer is selected in the slicer or filter, the top 5 customers visual should adjust accordingly based on the selected customer.

If you encounter any issues or need further assistance with implementing this in Power BI, feel free to provide more details, and I can assist you further.

 

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

 

In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.

View solution in original post

1 REPLY 1
123abc
Community Champion
Community Champion

You can use DAX measures combined with slicers or filters. Here's a general approach you can follow:

  1. Create a Measure for the Top 5 Customers: You need to create a DAX measure that calculates the relevant metric for your customers and returns the top 5 based on the selection.

  2. Use a Slicer or Filter for Customer Selection: Ensure you have a slicer or filter visual on your report page that allows users to select a specific customer.

  3. Apply the Measure to Your Visual: Apply the DAX measure you created in step 1 to the visual that displays the top 5 customers. This visual could be a table or a bar chart, depending on your preference.

Here's a sample DAX measure that calculates the metric (let's call it "Metric") and returns the top 5 customers based on the selected customer:

 

Top 5 Customers =
VAR SelectedCustomer = SELECTEDVALUE('Customer'[CustomerName])
RETURN
TOPN(5,
FILTER(ALL('Customer'),
'Customer'[CustomerName] = SelectedCustomer
),
[Metric], DESC
)

 

Replace 'Customer'[CustomerName] with the actual column reference to your customer names, and [Metric] with the actual metric you're measuring (e.g., sales, revenue, etc.).

Once you have the measure in place, you can apply it to your visual representing the top 5 customers. When a specific customer is selected in the slicer or filter, the top 5 customers visual should adjust accordingly based on the selected customer.

If you encounter any issues or need further assistance with implementing this in Power BI, feel free to provide more details, and I can assist you further.

 

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

 

In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.

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.

Top Solution Authors