Forum Discussion

QQB's avatar
QQB
Frequent Visitor
2 years ago
Solved

Last date in period issue when use DatesBetween

Hello,  It's the first time I am posting a question here. Hopefully I do it right.  I have a question with Last date issue when use DATESBETWEEN function hope someone can help with.    I have a pa...
  • MattAllington's avatar
    2 years ago

    I suggest you write some custom time Intelligence. I talk about it here 

    https://exceleratorbi.com.au/dax-time-intelligence-beginners/

    and here (additional features of a good calendar table) 

    https://exceleratorbi.com.au/power-bi-calendar-tables/


    once you have a monthID column in your calendar table, use that to do your calendar time shift. All you need to do in the filter portion is filter the calendar table, you don't need all that extra datesbetween stuff.

     

    FILTER(ALL(Calendar),Calendar[MonthID] >= MIN(Calendar[MonthID])-[Parameter value] &&

    Calendar[MonthID] <= MIN(Calendar[MonthID]))

     

    with the above filter, you can then extract the dates 

    CALCULATE(MIN(Calendar[Date]),

    FILTER(ALL(Calendar),Calendar[MonthID] >= MIN(Calendar[MonthID])-[Parameter value] &&

    Calendar[MonthID] <= MIN(Calendar[MonthID]))
    )