Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Benx
Helper I
Helper I

Adding custom PI Quarters to my date table

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:

Benx_0-1635358613452.png

 

I attempted to use IF and DATEBETWEEN functions, but could not achieve the desired results. 

 

PI Quarter =
VAR FY22Q1StartDate =
    DATE ( 20210630 )
VAR FY22Q1EndDate =
    DATE ( 2021107 )
VAR FY22Q2StartDate =
    DATE ( 2021108 )
VAR FY22Q2EndDate =
    DATE ( 2022113 )
RETURN
    IF (
        DATESBETWEEN (
            Dates[Date],
            FY22Q1StartDate,
            FY22Q1EndDate
        ),
        "FY22 -Q1",
        IF (
            DATESBETWEEN (
                Dates[Date],
                FY22Q2StartDate,
                FY22Q2EndDate
            ),
            "FY22 -Q2",
            BLANK ()
        )
    )

 

Benx_0-1635360162953.png

 

Can anyone recommend a DAX approach that would work here? 

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@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"
)
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

2 REPLIES 2
Fowmy
Super User
Super User

@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"
)
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Thank you @Fowmy ! I appreciate the assistance!

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.