Forum Discussion
Remove previous months while keeping items with no data
I would like to remove the following circled months from this bar visualization, but keep the bars post October 2022 and any future months with no data.
I have selected "Show items with no data" on the X-axis.
However, if I unselect ""Show items with no data," then I get the bars post Oct 2022, but don't see December 2022, April 2023 or June 2023.
If I add the following filter, nothing happens:
I would like the visual to show as such:
2 Replies
- AhmedxSuper User
you need to read the earliest date and set the condition as follows
VAR _MinDate = CALCULATE(MIN('Calendar'[Date]), FILTER(ALL('tablesales'), [your mesure]> 0)
VAR Result = IF ( MAX('Calendar'[Date])>=_MinDate , [your mesure])
RETURN
Result - AnonymousNot applicable
Hi Mkazil ,
One possible solution is to use a relative date filter on your date column, and set it to show items when the value is after or equal to October 1, 2022. This way, you can exclude the months before October 2022, and still see the months with no data after that date.
To create a relative date filter, you can follow these steps:
Drag a date field from the Fields pane into the Filters on this page well or the Filters on all pages well in the Filters pane.
Select Relative date from the Filter type drop-down.
Once you’ve selected Relative date, you see three sections to change under Show items when the value, including a middle numeric box.
In the first section, select After or Equal to from the drop-down list.
In the second section, enter 1 as the number of units.
In the third section, select Months (Calendar) as the unit of time.
Alternatively, you can also use a DAX expression to calculate and filter based on dates. For example, you can use CALCULATE with a filter condition on your date column.Solved: Using Calculate with Filter on Current Month Colum... - Microsoft Fabric Community
Create a relative date slicer or filter in Power BI - Power BI | Microsoft Learn
How to Get Your Question Answered Quickly
If I have misunderstood your meaning please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Community Support Team _ RongtieIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.