cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Venusura Helper III
Helper III

Line chart with total as a Legend

Hi,

 

Is it possible to show a total of sales as a legend in line chart?

 

I have got a dataset that contains Product(A,B,C), Date(2006,2007,2008) and Quantity(10,20,30) columns , Currenlty I'm getting a line per each product in line chart but I want to show a Total(Sum of all products) line.

 

I'm not sure whether it is possible or not in the power BI.

 

Any inputs would be much appriciated.

 

Thanks

 

 

5 REPLIES 5
Community Support
Community Support

Re: Line chart with total as a Legend

Hi @Venusura ,

You could create a calculated column to as a legend, like this:

Total = SUM('Table'[Quantity])

4.PNG5.PNG 

You could add filters based on your actual data model.

 

Best Regards,

Xue Ding

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

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Venusura Helper III
Helper III

Re: Line chart with total as a Legend

@v-xuding-msft , I want to have a total as a seperate line aloging with other category, plesae see the below fig: I draw the red line which i need to get in the chart.

 

Line chart.PNG

Thank you,

Community Support
Community Support

Re: Line chart with total as a Legend

Hi @Venusura ,

There is a limitation for this scenario. After draging column into the "Legend" field, we can only add one value into "Value" field. For your request, we can't add another column or measure about total values when we have put the "Product" column into "Legend" Field. There are two workarounds that you could try.

  • If there are not many products in your table, you could create measures per products to show them.

 

a = CALCULATE(SUM('Table'[Amount]),FILTER('Table','Table'[Product] = "a"))
b = CALCULATE(SUM('Table'[Amount]),FILTER('Table','Table'[Product] = "b"))
Total = CALCULATE(SUM('Table'[Amount]),ALL('Table'[Product]))

 

1.PNG

  • If there are many products, please try to use a slicer to filter per products

 

Measure = CALCULATE(SUM('Table'[Amount]),ALLSELECTED('Table'[Product]))
Total = CALCULATE(SUM('Table'[Amount]),ALL('Table'[Product]))

 

2.PNG

Best Regards,

Xue Ding

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

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

Re: Line chart with total as a Legend

Hi @Venusura ,

Do you try the ways? Do they make sense? If the answer is helpful, please accept it as a solution. If you solved by yourself, welcome to share the solution. More people who have the same request will benefit here.

 

Best Regards,

Xue Ding

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

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Venusura Helper III
Helper III

Re: Line chart with total as a Legend

@v-xuding-msft , This won't works for me, as all measures needs to be created manually, what if I have thousands of categories?

 

I want to have line per each product and totla line.

 

Helpful resources

Announcements
Announcing the New Spanish Forum

Announcing the New Spanish Forum

Do you need help in Spanish? Check out our new Spanish community section.

April 2020 Community Highlights

April 2020 Community Highlights

Info on our Super Users, MBAS content and badges, and updates to our support articles. - Read the full Community Highlights.

MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

Top Solution Authors
Top Kudoed Authors