Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hi All,
I am trying to automate a report heading with a dynamic format text string so the the formula returns this -
Q1 2023-24
June - September 2023
For the previous fiscal quarter based on todays date. I have tried a few DAX formula like this -
PreviousQuarterText =
VAR CurrentDate = TODAY()
VAR PreviousQuarterStart = STARTOFQUARTER(DATEADD(CurrentDate, -1, QUARTER))
VAR PreviousQuarterEnd = ENDOFQUARTER(DATEADD(CurrentDate, -1, QUARTER))
VAR PreviousYear = YEAR(CurrentDate) - 1
RETURN
"Q" & FORMAT(QUARTER(PreviousQuarterStart), "0") & " " &
FORMAT(PreviousYear, "0000") & "-" & FORMAT(PreviousYear + 1, "0000") & UNICHAR(10) & UNICHAR(10) &
FORMAT(PreviousQuarterStart, "MMMM") & " - " & FORMAT(PreviousQuarterEnd, "MMMM YYYY")
But this does not recognize the 'CurrentDate' or 'PreviousYear' parameters.
Would anyone have any suggestions please? (PS. I have a Fiscal year calendar table if that helps)
@Disaster110 , Try these formula
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))
Thankyou @amitchandak
This looks like it should work, and I will only use the "Last Qtr today" section.
However, Power BI does not recognise the [Net] function. Could you explain or correct this part please?
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.