Forum Discussion
Power BI Date Slicer For Time Frame
Hi Everyone,
I have a dashboard that shows bunch of metrics.
Some if these metrics are line charts showing values agains date.
I would like to add a Date slicer and choose month to change date. For example when I choose october 2023, I want to see dates, upto October 2023.
Currently when I filter a month on the slicer, it shows only selected month from slicer.
I can do this(showed below) with Before selection on slicer but it's not user friendly. I want users simply choose month from drop down.
To sort this out think that I have a simple table with two columns. First column is Date and Second column is Values.
I also have a Date Table and created relationship between two tables.
Bonus Question:
My Final goal is two have last 3 calendar months.
I managed to capture last 3 months in visual but I would prefer to do it on measure.
Thanks.
3 Replies
- amitchandak
Super User
Anonymous , for that you have to use a slicer on an independent/disconnected table
//Date1 is an independent Date table, Date is joined with Table
new measure =
var _max = maxx(allselected(Date1),Date1[Date])
var _min = eomonth(_max, -12) +1
return
calculate( sum(sales[Gross Sales]), filter('Date', 'Date'[Date] >=_min && 'Date'[Date] <=_max))Need of an Independent/disconnected Date Table:https://www.youtube.com/watch?v=44fGGmg9fHI
- AnonymousNot applicable
Thanks Amit,
I checked the video but it shows with a between slicer. I want to get rid of before slicer (and not use between slicer) and use only a dropdown slicer to choose Report Month.
- AnonymousNot applicable
There is a very similiar question I found.
At that one everything works but I only need to see Year Month in Date Slicer, currently all days are coming in the slicer.