Forum Discussion

ktt777's avatar
ktt777
Icon for Helper V rankHelper V
5 years ago
Solved

SORTING, DISPLAY CLUSTERED BAR CHART

Hi, 

i have below clustered bar chart. I have few questions: 

1.How can i sort it based on Total of blue + red value ? Right now i can only sort either blue or red value

2. How can i show percentage of blue over total for each bar? example 1st bar : 100%....

3. How can the graph only show the top bar that contribute up to 80% of total value ? 

 

thanks, 

3 Replies

  • ktt777 

    since you don't provide the sample data , I created some simple data.

    1. did you create a measure to calculate the value? what's your measure? it should sort by total by default

    2.you can create a measure

    perc = sum('Table (3)'[amount])/CALCULATE(SUM('Table (3)'[amount]),ALLEXCEPT('Table (3)','Table (3)'[product]))

     

    or add that measure to tooltips

    3. I think the workaround is to create a new table

    new table = 
    var tbl=ADDCOLUMNS(SUMMARIZE('Table (3)','Table (3)'[product],'Table (3)'[type],"amount",sum('Table (3)'[amount])),"percentage",[amount]/CALCULATE(sum('Table (3)'[amount]),ALLEXCEPT('Table (3)','Table (3)'[product])))
    return FILTER(tbl,[percentage]>=0.8&&'Table (3)'[type]="1" || [percentage]<0.2 && 'Table (3)'[type]="2")