Forum Discussion
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
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
A filter is set to represent only the most recent data
The tooltips on this visual are different according of the 3 stacked values M1, M2, M3
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.
- Anonymous5 years ago
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.
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.
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.
3 Replies
- amitchandak
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
- AnonymousNot 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.- AnonymousNot applicable
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.
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.
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.