Forum Discussion

dogt1225's avatar
dogt1225
Helper III
3 years ago

Dynamically Filter to Most Recent Quarter

I have a PowerBI visual where I will like the visual to be dynamically filtered to the latest Fiscal Year Quarter. The current Fiscal Year quarter is FY2024-Q1. Any ideas on how to do this?

 

 

1 Reply

  • dogt1225 , Try a measure like, you can adjust calculation to suite FY, if qtr does not start from Jan, Apr, Jul, Oct

     

    QTD Today =
    var _max = today()
    var _min = eomonth(_max,-1* if( mod(Month(_max),3) =0,3,mod(Month(_max),3)))+1
    return
    CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

    QTD Yesterday =
    var _max = today()-1
    var _min = eomonth(_max,-1* if( mod(Month(_max),3) =0,3,mod(Month(_max),3)))+1
    return
    CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

    LQTD Today =
    var _max = Date(year(today()), Month(Today())-3, day(today()))
    var _min = eomonth(_max,-1* if( mod(Month(_max),3) =0,3,mod(Month(_max),3)))+1
    return
    CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

    LYQTD Today =
    var _max = Date(year(today())-1, Month(Today()), day(today()))
    var _min = eomonth(_max,-1* if( mod(Month(_max),3) =0,3,mod(Month(_max),3)))+1
    return
    CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

    This Qtr Today =
    var _today = today()
    var _max = eomonth(_today, if( mod(Month(_today),3) =0,0,3-mod(Month(_today),3)))
    var _min = eomonth(_max,-3)+1
    return
    CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

    Last Qtr Today =
    var _today = today()
    var _max = eomonth(_today, -1*if( mod(Month(_today),3) =0,3,mod(Month(_today),3)))
    var _min = eomonth(_max,-3)+1
    return
    CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

    Same Qtr Last Year Today =
    var _today = today()
    var _max = eomonth(eomonth(_today, if( mod(Month(_today),3) =0,0,3-mod(Month(_today),3))),-12)
    var _min = eomonth(_max,-3)+1
    return
    CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

    First Qtr This year Today =
    var _min = eomonth(today(),-1*month(Today()))+1
    var _max = eomonth(_min,2)
    return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

    Last Qtr Last year Today =
    var _max = eomonth(today(),-1*month(Today()))
    var _min = eomonth(_max,-3)+1
    return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))