Forum Discussion

kcsteele's avatar
kcsteele
Helper I
4 years ago
Solved

Simple column chart question about adding extra bars/columns from a different table column?

Hello,   I have a very simple question about the column chart visual, is it possible to add extra bars/columns from a different table/columns next to the main columns?  
  • v-yalanwu-msft's avatar
    4 years ago

    Hi, kcsteele ;

    You could add row by power query or use dax add rows. then create a measure. here I use dax to add rows.

    1.create a new table.

    New table = var _a=SUMMARIZE('Table',[Index],[Year],[percent])
    var _b=SUMMARIZE('Table',"Index",MAX('Table'[Index])+1,"Year","16-20","percent",BLANK())
    var _c=SUMMARIZE('Table',"Index",MAX('Table'[Index])+2,"Year","85-20","percent",BLANK())
    return UNION(_a,_b,_c)

    2.create a measure.

    value =
    SWITCH (
        MAX ( [Year] ),
        "16-20",
            CALCULATE (
                SUM ( 'Table'[percent] ),
                FILTER ( 'Table', [Year] <= 20 && [Year] >= 16 )
            ),
        "85-20", CALCULATE ( SUM ( 'Table'[percent] ), FILTER ( 'Table', [Year] <= 20 ) ),
        MAX ( [percent] ))
    

    The final output is shown below:

    If not right ,please share more details.

    Best Regards,
    Community Support Team_ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.