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

Be 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

Reply
Anonymous
Not applicable

Remove future months from a bar chart Year on Year Comparison

Hi Everyone,

 

I have spent some time trying to find a solution to my issue in different forums, but with no luck. Hopefully, it will not be a duplicated issue or someone can help me out.

 

I have the following bar chart, which calculates the difference between 2023 and 2022 with the number of pieces. 

waltiritin_0-1673451762813.png

waltiritin_3-1673453735332.png

 

 

The chart and the metrics on the chart work perfectly fine, as you can see we have the comparisson for January (-38.8% less pieces than in January 2022). The PROBLEM is that I have been trying to hide or remove the values of the future months (on this case, today is 11th of January, so all the values from February onwards), but with no luck. 

 

What I tried is to use the following: IF ( MONTH('Table'[Date]) <= MONTH(TODAY()), [6. YoY 22vs23], 0), but for the first statement (<logical_test>), I can not use a column, only a measure and I can not convert my actual month_name date into a measure. 

 

This is my sample data:

waltiritin_2-1673453631511.png

6. YoY 22vs23 = DIVIDE([1. Current Year], [2. Current Year -1], 0)-1  --> to get the YoY %

 

Many thanks in advance.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

As a solution in PBI, only applying a filter to the visualization that is different than -1, already removed the future months due to the metric was the difference between months on YoY, so if we do not have data on 2023 yet, I would always be -100% = -1.

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , Create a measure like

 

IF ( MONTH('Table'[Date]) <= MONTH(TODAY()), [6. YoY 22vs23], Blank())

 

 

or create a measure like

 

if(max(Date[Date]) < eomonth(Today(),0) ,1,0)  and use that as a visual level filter value =1

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

Hi @amitchandak , the problem I have is that in this specific data set I do not have the proper date, only month name or month number, and when I try to use these both in the creation of the measures it does not recognize them. 

I already found a solution in SQL creating a case statement with "0" and "1" when the month_date is higher than the current date and using it as a filter, but I would like to know if there is a way to solve it in PBI. 

 

Anonymous
Not applicable

As a solution in PBI, only applying a filter to the visualization that is different than -1, already removed the future months due to the metric was the difference between months on YoY, so if we do not have data on 2023 yet, I would always be -100% = -1.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.