Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Add total in line chart

Hello, I need to add total Line in line Chart, this nes total line dont change if filter country is selected. Thanks for your support.

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi  Anonymous ,

     

    Thanks AUDISU  for sharing, I also have a method here:

    Here are the steps you can follow:

    1. Create calculated table.

     

    Table 2 =
    var _table1=
    DISTINCT('Table'[Country])
    var _table2=
    {"Total"}
    return
    UNION(
        _table1,_table2)

     

    2. Create measure.

     

    Measure =
    IF(
        MAX('Table 2'[Country]) = "Total",SUMX(FILTER(ALL('Table'),'Table'[Date]=MAX('Table'[Date])),'Table'[TotalSales]),SUMX(FILTER('Table','Table'[Country]=MAX('Table 2'[Country])&&'Table'[Date]=MAX('Table'[Date])),[TotalSales]))

     

     3. Result:

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

     

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  Anonymous ,

     

    Thanks AUDISU  for sharing, I also have a method here:

    Here are the steps you can follow:

    1. Create calculated table.

     

    Table 2 =
    var _table1=
    DISTINCT('Table'[Country])
    var _table2=
    {"Total"}
    return
    UNION(
        _table1,_table2)

     

    2. Create measure.

     

    Measure =
    IF(
        MAX('Table 2'[Country]) = "Total",SUMX(FILTER(ALL('Table'),'Table'[Date]=MAX('Table'[Date])),'Table'[TotalSales]),SUMX(FILTER('Table','Table'[Country]=MAX('Table 2'[Country])&&'Table'[Date]=MAX('Table'[Date])),[TotalSales]))

     

     3. Result:

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

     

  • AUDISU's avatar
    AUDISU
    Resolver III

    Hi Anonymous ,

    Create a mesure removing country filter then add it to line chat.
    Use following mesure and change table and column names as your data model.

    Total Sales (No Country Filter) = CALCULATE(SUM('Sales'[SalesAmount]), ALL('Sales'[Country]))

    Thanks

    DISU

    • mmm286b's avatar
      mmm286b
      Helper I

      I'm trying with measure but I can only see one Line. 😕