March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello,
I am trying to create a line chart with three lines: Line A, Line B and the Total of Line A and B. At the moment, I can only do Line A and B OR the Total.
Is there a way of having all three on the same chart?
I have tried creating a measure to return the total so that I can add it to the line chart, but it doesn't let me add it:
Total = CALCULATE(SUM(Table[Amount]), Table[Category]="Line A")+CALCULATE(SUM(Table[Amount]), Table[Category]="Line B")
Any thoughts?
Thanks!
Solved! Go to Solution.
Hi @bullius,
In your scenario, I would suggest you create three measures: values for LineA, LineB and Total. Then place those three measures in chart Values property, without dragging any value to Legend property. Please refer to screenshots below:
Aliqui = CALCULATE(SUM(SalesFact[Units]),Manufacturer[Manufacturer]="Aliqui")
Natura = CALCULATE(SalesFact[Total Units],Manufacturer[Manufacturer]="Natura")
Total = CALCULATE(SUM(SalesFact[Units]),Manufacturer[Manufacturer]="Aliqui") + CALCULATE(SUM(SalesFact[Units]),Manufacturer[Manufacturer]="Natura")
If you have any question, please feel free to ask.
Best Regards,
Qiuyun Yu
The solution needs to be dynamic - new values may be added to the field in question in the future. Hard-coding a new value would mean manually maintaining it in the future. Not a very scalable option.
Confused as to why this was not built into Power BI, as this is basic functionality in excel. The "total" value is simply the result when you remove a field from the "group by" section.
Any news on this? I have same issue now and I really don't want to hardcode a calculation for each series and the total.
Hi @bullius,
In your scenario, I would suggest you create three measures: values for LineA, LineB and Total. Then place those three measures in chart Values property, without dragging any value to Legend property. Please refer to screenshots below:
Aliqui = CALCULATE(SUM(SalesFact[Units]),Manufacturer[Manufacturer]="Aliqui")
Natura = CALCULATE(SalesFact[Total Units],Manufacturer[Manufacturer]="Natura")
Total = CALCULATE(SUM(SalesFact[Units]),Manufacturer[Manufacturer]="Aliqui") + CALCULATE(SUM(SalesFact[Units]),Manufacturer[Manufacturer]="Natura")
If you have any question, please feel free to ask.
Best Regards,
Qiuyun Yu
That solution works. Thank you!
Sorry to re-animate old topic - but I'm having the same issue and proposed solution does not work (as it's not practical once you hit more than 5-6 categories). Is there an easier way to bring Total line to the line chart? Thank you!
It doesn't give me a message. It doesn't let me drag the measure on to the Legend field so that I have the Total as well as the two categories.
When I try to add the measure to the value field, it allows me to replace "Amount", but not have both. This results in Line A and B both showing the total of Line A and B (according to the measure).
I should have been clearer - it lets me create the measure, but does not let me add it to the line chart in a way that resuts in the three desired lines.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
134 | |
91 | |
90 | |
64 | |
58 |
User | Count |
---|---|
201 | |
137 | |
107 | |
72 | |
68 |