Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
anileshknpowerb
Helper III
Helper III

How to show only few bars in Bar chart

I have a bar chart that shows Revenue by Years. By default it shows data for all years. I need to show the bars for Current year+2, ie, suppose current year is 2020, bar should only show for 2020, 2021 and 2022.

 

How do i achieve this?

 

Capture2.PNG

1 ACCEPTED SOLUTION
v-zhenbw-msft
Community Support
Community Support

Hi @anileshknpowerb ,

 

We can create two measures to meet your requirement, one calculates the next year value, another calculates the next two years value.

 

Next_year = CALCULATE(SUM('Table'[value]),FILTER(ALLSELECTED('Table'),'Table'[Year] = MAX('Table'[Year])+1))

 

Next two year = CALCULATE(SUM('Table'[value]),FILTER(ALLSELECTED('Table'),'Table'[Year] = MAX('Table'[Year])+2))

 

How1.jpg

 

If it doesn’t meet your requirement, could you please provide a mockup sample based on fake data or describe the fields of each tables and the relations between tables simply?

 

It will be helpful if you can show us the exact expected result based on the tables.

 

Please upload your files to OneDrive For Business and share the link here. Please don't contain any Confidential Information or Real data in your reply.

BTW, pbix as attached.

 

Best regards,

 

Community Support Team _ zhenbw

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

View solution in original post

5 REPLIES 5
v-zhenbw-msft
Community Support
Community Support

Hi @anileshknpowerb ,

 

How about the result after you follow the suggestions mentioned in my original post?
Could you please provide more details or expected result about it If it doesn't meet your requirement?

 

If you've fixed the issue on your own please kindly share your solution.

 

Best regards,

 

Community Support Team _ zhenbw

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

v-zhenbw-msft
Community Support
Community Support

Hi @anileshknpowerb ,

 

We can create two measures to meet your requirement, one calculates the next year value, another calculates the next two years value.

 

Next_year = CALCULATE(SUM('Table'[value]),FILTER(ALLSELECTED('Table'),'Table'[Year] = MAX('Table'[Year])+1))

 

Next two year = CALCULATE(SUM('Table'[value]),FILTER(ALLSELECTED('Table'),'Table'[Year] = MAX('Table'[Year])+2))

 

How1.jpg

 

If it doesn’t meet your requirement, could you please provide a mockup sample based on fake data or describe the fields of each tables and the relations between tables simply?

 

It will be helpful if you can show us the exact expected result based on the tables.

 

Please upload your files to OneDrive For Business and share the link here. Please don't contain any Confidential Information or Real data in your reply.

BTW, pbix as attached.

 

Best regards,

 

Community Support Team _ zhenbw

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

Nice!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Daviejoe
Memorable Member
Memorable Member

Do you have a date table?

 

Test out adding a calculated column into your date table that gives a identifies the current year and the following two years and you can apply that as a filter on the visual.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




parry2k
Super User
Super User

@anileshknpowerb you can use relative date filtering

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos 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.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.