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.
Hello all,
I'm trying to create a column in my date table that groups a range of specific, defined dates into a PI Quarter. Each PI quarter needs to start with the open date of the first sprint in each quarter, and end with the close date of the last sprint in the quater. These do not align nicely with the calendar quarter.
For example, here are the start and end dates for first two PI Quarters of the fistcal year:
PI Quarter 1 : 6/30/2021 - 10/7/2021
PI Quarter 2 : 10/8/2021 - 1/13/2022
Desired abreviated result:
I attempted to use IF and DATEBETWEEN functions, but could not achieve the desired results.
PI Quarter =
VAR FY22Q1StartDate =
DATE ( 2021, 06, 30 )
VAR FY22Q1EndDate =
DATE ( 2021, 10, 7 )
VAR FY22Q2StartDate =
DATE ( 2021, 10, 8 )
VAR FY22Q2EndDate =
DATE ( 2022, 1, 13 )
RETURN
IF (
DATESBETWEEN (
Dates[Date],
FY22Q1StartDate,
FY22Q1EndDate
),
"FY22 -Q1",
IF (
DATESBETWEEN (
Dates[Date],
FY22Q2StartDate,
FY22Q2EndDate
),
"FY22 -Q2",
BLANK ()
)
)
Can anyone recommend a DAX approach that would work here?
Solved! Go to Solution.
@Benx
You can modify your code as follows:
PI Quarter =
VAR FY22Q1StartDate =
DATE ( 2021, 06, 30 )
VAR FY22Q1EndDate =
DATE ( 2021, 10, 7 )
VAR FY22Q2StartDate =
DATE ( 2021, 10, 8 )
VAR FY22Q2EndDate =
DATE ( 2022, 1, 13 )
VAR _DATE = Dates[Date]
RETURN
SWITCH(
TRUE(),
_DATE >= FY22Q1StartDate && _DATE <= FY22Q1EndDate , "FY22 -Q1",
_DATE >= FY22Q2StartDate && _DATE <= FY22Q2EndDate , "FY22 -Q2"
)
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
@Benx
You can modify your code as follows:
PI Quarter =
VAR FY22Q1StartDate =
DATE ( 2021, 06, 30 )
VAR FY22Q1EndDate =
DATE ( 2021, 10, 7 )
VAR FY22Q2StartDate =
DATE ( 2021, 10, 8 )
VAR FY22Q2EndDate =
DATE ( 2022, 1, 13 )
VAR _DATE = Dates[Date]
RETURN
SWITCH(
TRUE(),
_DATE >= FY22Q1StartDate && _DATE <= FY22Q1EndDate , "FY22 -Q1",
_DATE >= FY22Q2StartDate && _DATE <= FY22Q2EndDate , "FY22 -Q2"
)
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
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 |
---|---|
49 | |
25 | |
20 | |
15 | |
12 |
User | Count |
---|---|
57 | |
49 | |
44 | |
18 | |
18 |