Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Administrator
2 years ago
Solved

Total Line Bar Chart

Hello, I have a database in which sales to different countries and in different years appear.

I have created a graph with the TOP 4 countries to which the most quantity has been sold (on the 'y-axis' the quantity and on the 'x-axis' the years).

What I'd like to do is create a line in the bar chart that shows the total sales to all countries.
What I manage to do is that this line shows me the total sales of those 4 countries added together, but I want the total, that is, that the TOP filter does not affect the 'secondary y-axis' and the line. Is this possible? Thank you!

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Syndicate_Admin ,
    Here some steps that I want to share, you can check them if they suitable for your requirement.
    Here is my test data:

    1. Create a measure

    Total Sales = CALCULATE(SUM([Sales]), REMOVEFILTERS('Table'[Sales],'Table'[Year]))

    2.Choose Line and clustered column chart


    Final output

     

     

     

    Best regards,

    Albert He

     

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

     



2 Replies

  • Jonvoge's avatar
    Jonvoge
    Most Valuable Professional

    Hi!

     

    You'll need to create a Calculated Measure like the following, to return the total sales for all countries:

     

    Measure = 

    Calculate(Sum(SalesAmount), All('Table', 'Table'[Country])

     

    The 'All' function removes all filters from the Country column.

    Try the above measure in your visual, and see if it works!

    _____________________________________________________
    I hope my comment was helpful.
    If your question was answered, please mark your post as 'Solved' and consider giving me a 'Thumbs Up'.
    Find me on LinkedIn, Sessionize, or my blog Downhill Data

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Syndicate_Admin ,
    Here some steps that I want to share, you can check them if they suitable for your requirement.
    Here is my test data:

    1. Create a measure

    Total Sales = CALCULATE(SUM([Sales]), REMOVEFILTERS('Table'[Sales],'Table'[Year]))

    2.Choose Line and clustered column chart


    Final output

     

     

     

    Best regards,

    Albert He

     

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