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
Anonymous
Not applicable

How to make a customized tooltip for stacked column chart

Hello,

 

I'm using the table F_SURVEY with the fields: PK_SURVEY, GROUP, M1, M2, M3 and YEAR
F_SURVEY.png

 

 

 

 

 

 

 

 

 

 

 

To select the most recent data I added a calculated column:

Is Most Recent Data = IF(F_SURVEY[YEAR] = MAX(F_SURVEY[YEAR]); 1; 0)


I represent the data in a Stacked Column Chart

stacked_column_chart.png

 

 

 

 

 

 

 

 

 

 

 

 

 

A filter is set to represent only the most recent data

filter.png

 

 

 

 

The tooltips on this visual are different according of the 3 stacked values M1, M2, M3

 

tooltips.png

 

I want the tooltips different:

YEAR       2020
GROUP   group 5
M1          14%

 

YEAR       2020
GROUP   group 5
M2          78%

 

YEAR       2020
GROUP   group 5
M3          8%

 

How can I do this?
The main question is how can I,  in a customized tooltip,  let the last line switch between M1, M2 and M3 according the block I hover over?

 

Thanks

 

R.W.

1 ACCEPTED SOLUTION

Hi @Anonymous 

The result you want is to show 14%(should in M3) in M1,8%(should in M1) in M3, 78%(should in M2) in M2.

You can try to unpivot your table and then build a measure.

Select M1,M2,M3 in power query and use unpivot option.

2.png

Measure:

Measure = 
VAR _M1 = CALCULATE(SUM(F_SURVEY[PERCENTAGE]),FILTER(ALL(F_SURVEY),F_SURVEY[GROUP]=MAX(F_SURVEY[GROUP])&&F_SURVEY[M TYPE]="M1"&&F_SURVEY[YEAR]=MAX(F_SURVEY[YEAR])))
VAR _M2 = CALCULATE(SUM(F_SURVEY[PERCENTAGE]),FILTER(ALL(F_SURVEY),F_SURVEY[GROUP]=MAX(F_SURVEY[GROUP])&&F_SURVEY[M TYPE]="M2"&&F_SURVEY[YEAR]=MAX(F_SURVEY[YEAR])))
VAR _M3 = CALCULATE(SUM(F_SURVEY[PERCENTAGE]),FILTER(ALL(F_SURVEY),F_SURVEY[GROUP]=MAX(F_SURVEY[GROUP])&&F_SURVEY[M TYPE]="M3"&&F_SURVEY[YEAR]=MAX(F_SURVEY[YEAR])))
RETURN
SWITCH(MAX(F_SURVEY[M TYPE]),"M1",_M3,"M3",_M1,_M2)

Result is as below.

3.png

Best Regards,

Rico Zhou

 

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

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , You can add a year to the tooltip

or you can create a tooltip page : https://docs.microsoft.com/en-us/power-bi/desktop-tooltips

Anonymous
Not applicable

Thanks @amitchandak 

 

I knew how to make a tooltip but I don't see a solution for how I can,  in a customized tooltip,  let the line that refers to the values switch between the value fieldnames according the block I hover over. Just as the standard tooltip does.

R.W.

Hi @Anonymous 

The result you want is to show 14%(should in M3) in M1,8%(should in M1) in M3, 78%(should in M2) in M2.

You can try to unpivot your table and then build a measure.

Select M1,M2,M3 in power query and use unpivot option.

2.png

Measure:

Measure = 
VAR _M1 = CALCULATE(SUM(F_SURVEY[PERCENTAGE]),FILTER(ALL(F_SURVEY),F_SURVEY[GROUP]=MAX(F_SURVEY[GROUP])&&F_SURVEY[M TYPE]="M1"&&F_SURVEY[YEAR]=MAX(F_SURVEY[YEAR])))
VAR _M2 = CALCULATE(SUM(F_SURVEY[PERCENTAGE]),FILTER(ALL(F_SURVEY),F_SURVEY[GROUP]=MAX(F_SURVEY[GROUP])&&F_SURVEY[M TYPE]="M2"&&F_SURVEY[YEAR]=MAX(F_SURVEY[YEAR])))
VAR _M3 = CALCULATE(SUM(F_SURVEY[PERCENTAGE]),FILTER(ALL(F_SURVEY),F_SURVEY[GROUP]=MAX(F_SURVEY[GROUP])&&F_SURVEY[M TYPE]="M3"&&F_SURVEY[YEAR]=MAX(F_SURVEY[YEAR])))
RETURN
SWITCH(MAX(F_SURVEY[M TYPE]),"M1",_M3,"M3",_M1,_M2)

Result is as below.

3.png

Best Regards,

Rico Zhou

 

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

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.