Forum Discussion
How to Create A Line / Bar Chart with Multiple Lines and One Bar Representing Years
I would like to create a chart in power BI with multiple lines and one bar representing annual sales, similar to the below in Excel. Any help would be greatly appreciated. Thank youQ
- Anonymous4 years ago
Hi ShrimpSurf ,
If you have a year column, filter as follows.
Formula = CALCULATE ( SUM ( [Sales] ), FILTER ( 'Table', [Year] = 2017 ) )If you have a date column without a year column, filter as follows.
Formula = CALCULATE ( SUM ( [Sales] ), FILTER ( 'Table', YEAR ( [Date] ) = 2017 ) )You can also use slicer to filter year.
Slicers in Power BI - Power BI | Microsoft Docs
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 Replies
- parry2k
Super User
ShrimpSurf use Line and Clusterd column chart:
- add measure on the columns vales
- add multiple measures on the line values
✨ Follow us on LinkedIn and to our YouTube channel
Learn about conditional formatting at Microsoft Reactor
My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.
- ShrimpSurf
Helper II
What time filter would you use in a caculate formula to filter the year? Sorry, new to PBI.
- AnonymousNot applicable
Hi ShrimpSurf ,
If you have a year column, filter as follows.
Formula = CALCULATE ( SUM ( [Sales] ), FILTER ( 'Table', [Year] = 2017 ) )If you have a date column without a year column, filter as follows.
Formula = CALCULATE ( SUM ( [Sales] ), FILTER ( 'Table', YEAR ( [Date] ) = 2017 ) )You can also use slicer to filter year.
Slicers in Power BI - Power BI | Microsoft Docs
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
Hi ShrimpSurf ,
Could you tell me if your problem has been solved?
If it is, kindly Accept it as the solution. More people will benefit from it.
Or you are still confused about it, please provide me with more details about your problem.
Best Regards,
Stephen Tao