Search code examples
powerbifilteringdaxmeasure

Need to limit the current date by the end of previous month in Power BI Slicer


I have a report in Power BI Desktop, with the slicer - YearMonthSort - which has data selection by Year-Month

Plz, see the screenshot below:

enter image description here

My goal is to limit data in this slicer as - to the end of previous month.

For example, if today is 8/21/2019, I need my Report to show data until 07/31/2019.

And, since I have it in the "Year-Month" format, it should be limited (displayed as 2019-07)

When I needed to limit this slicer by today's date I used

IsToday = SWITCH (TRUE (),'Dimension Date'[Date] <= NOW (), 1, 0) 

(by StackOverflow advice) What, if I need it to be limited until the last day of the previous month?

Thank you!


Solution

  • You would create a calculated column similar to this one:

    IsLDPreviusMonth = SWITCH (
                         TRUE (),
                         'Dimension Date'[Date] <= EOMONTH( NOW(), - 1), 
                         1, 
                         0
    ) 
    

    EOMONTH