In Power BI, we are dealing with different data like sales, revenue, expense, salary. While creating the visualizations or reports, in different cases like year-over-year comparison, YTD comparison or variance, the visual may show value for future months also.
The above visual is showing some amounts like income or sales Amount, Amount PY, Amount YTD current year, Amount YTD PY & YTD variance for year 2021.From the visual it is clear that there is a net income till September ( this blog is writing in first of Oct 2021 & having data till the date).Net Income YTD this month is same for remaining months as there is no income for future months.I’m writing here two simple codes, if your client wants to see the amount only for completed month,Add two calculated column in Date table. First for calculating last day of a month.
LastDateOfMonth = endofmonth(DateTable[Date])
Second once is to check whether the month is coming in future or not.
IsFutureMonth = IF(TODAY() > DateTable[LastDateOfMonth], 1, 0)
Now, in the new column IsFutureMonth have two values 1 & 0. You can apply visual level or page level filter as required using this column.
In the above, a page level filter is applied. There is only year slicer & not filtering for months. But as the applied filter, it is showing only the months till September in this visual as till September is completed
Praisy Joy
Data Analyst
Addend Analytics