Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

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: ...
  • Anonymous's avatar
    Anonymous
    5 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.