Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
115 | |
100 | |
88 | |
69 | |
61 |
User | Count |
---|---|
151 | |
120 | |
103 | |
87 | |
68 |