Forum Discussion
How to make a customized tooltip for stacked column chart
- 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.
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.
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.