Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago

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

  • 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