This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
I would like to create a report that returns data from last month, the month from the prior year, and all calendar quarter end dates in-between. Is this possible this date logic in Power BI and to build around a parameter datetime value?
Examples (MM/DD/YY):
Report Date: 2/28/17 (This would be a parameter)
Report Query Dates: 2/28/17, 12/31/2016, 9/30/16, 6/30/16, 3/31/16, 2/29/16
Report Date: 1/31/17 (This would be a parameter)
Report Query Dates: 1/31/17, 12/31/2016, 9/30/16, 6/30/16, 3/31/16, 1/31/16
Report Date: 12/31/16 (This would be a parameter)
Report Query Dates: 12/31/16, 9/30/16, 6/30/16, 3/31/16 12/31/16
Solved! Go to Solution.
Hi @seabrew
This calculated table should returns the dates you specified in a table
Return Dates =
VAR ReportDate = DATE(2017,2,28) ---<<< your parameter date here
VAR EndOfSameMonthLastYear = EOMONTH(ReportDate,-12)
VAR Quarters =
SELECTCOLUMNS(
FILTER(ADDCOLUMNS(
CALENDAR(
EndOfSameMonthLastYear,ReportDate
),
"Start Of Quarter" ,
IF( MONTH([Date]) in {3,6,9,12} && DAY([Date]) = 1 ,1 ,0)
,"End Of Quarter" , EOMONTH([Date],0)
),[Start Of Quarter]=1),"End Of Quarter",[End Of Quarter])
VAR Months = FILTER(
CALENDAR(
EndOfSameMonthLastYear,ReportDate
),
[Date] = ReportDate
|| [Date]= EndOfSameMonthLastYear
)
RETURN UNION (Months, Quarters)
Hi @seabrew
This calculated table should returns the dates you specified in a table
Return Dates =
VAR ReportDate = DATE(2017,2,28) ---<<< your parameter date here
VAR EndOfSameMonthLastYear = EOMONTH(ReportDate,-12)
VAR Quarters =
SELECTCOLUMNS(
FILTER(ADDCOLUMNS(
CALENDAR(
EndOfSameMonthLastYear,ReportDate
),
"Start Of Quarter" ,
IF( MONTH([Date]) in {3,6,9,12} && DAY([Date]) = 1 ,1 ,0)
,"End Of Quarter" , EOMONTH([Date],0)
),[Start Of Quarter]=1),"End Of Quarter",[End Of Quarter])
VAR Months = FILTER(
CALENDAR(
EndOfSameMonthLastYear,ReportDate
),
[Date] = ReportDate
|| [Date]= EndOfSameMonthLastYear
)
RETURN UNION (Months, Quarters)
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 30 | |
| 24 | |
| 23 | |
| 17 | |
| 15 |
| User | Count |
|---|---|
| 61 | |
| 36 | |
| 29 | |
| 22 | |
| 21 |