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.

v-xinruzhu-msft

How to use Tooltip to display breakdown data for a specified ranking

Scenario: 

In this post, tooltip and measure are utilized to show the breakdown of data for different classifications. 

 

Expected Result: 

Calculate the number of customers in each category, show the top five categories of customer number, merge other data into "others".  

vxinruzhumsft_0-1711704769210.png

And show the data details corresponding to the top five data through tooltip.  

vxinruzhumsft_1-1711704769211.png

If the data is merged into Others, the tooltip is blank. 

vxinruzhumsft_2-1711704799480.png

Sample Data: 

vxinruzhumsft_3-1711704812374.png

How: 

 

1.First create a Measure to calculate the number of Customers for each product 

 

 

count = CALCULATE(COUNT('Table'[Customer]), ALLEXCEPT('Table', 'Table'[Product])) 

 

 

vxinruzhumsft_4-1711704832731.png

2.This step is achieved by displaying the first five products of the number of customers based on the COUNT number, merging the other data into "Other". This is a Calculated column because we need to put it into a table and not be affected by the row context. 

 

 

Product1 =  
VAR _rank = RANKX(ALL('Table'), [count], , DESC, Dense) 
RETURN 
IF(_rank <= 5, [Product], "others") 

 

 

 

vxinruzhumsft_6-1711704965771.png

3.Here, we need to recalculate the number of Customers per Product based on the category names from the previous step. 

 

 

Customercount = CALCULATE(COUNT('Table'[Customer]), ALLEXCEPT('Table', 'Table'[Product1])) 

 

 

vxinruzhumsft_7-1711704983522.png

4.In this step I will explain how to create the tooltip. 

I created Page2 and then changed that Page to Tooltip in Format -> Canvas Setting -> Type 

 

vxinruzhumsft_0-1711705081198.png

 

Putting the breakdown data to be displayed into a table visualization. It's worth noting that you can achieve the desired effect in the Tooltip table without the Product field, but I chose to put in the Product field for readability. 

Putting the breakdown data to be displayed into a table visualization. It's worth noting that you can achieve the desired effect in the Tooltip table without the Product field, but I chose to put in the Product field for readability. 

vxinruzhumsft_1-1711705108942.png

 

Up to this point, the basic Tooltip is complete, but it is not possible to achieve the effect that Product is categorized as "others" and the Tooltip is empty. 

vxinruzhumsft_2-1711705108943.png

5.Next we'll create a Measure to implement the effect of the tooltip being empty when the product is categorized as "other". 

 

Measure =  
VAR _product = CALCULATE(MAX([Product]), FILTER('Table', [Product] = [Product1])) 
RETURN 
IF(MAX([Product1]) = "others", 0, 1) 

 

Put the measure into the visual-level filters, set up show items when the value is 1. 

 

vxinruzhumsft_3-1711705164333.png

 

Summary: 

This method can be used when you have a summary page and want to view specific details on the summary page. 

For more details about tooltips, you can read related document link: 

Create tooltips based on report pages 

Customize tooltips in Power BI 

 

Author: Xinyi X. 

Reviewer: Ula and Kerry