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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
aliyahussein
Regular Visitor

how to sort quarters

Hi, 

 

I would like to sort QRT as july-spet QTR 1, oct-dec QTR 2, jan-mar QTR 3 and apr-june QTR 4. Currently my visual goes QTR 4, QTR 2, QTR 3, QTR 1. 

aliyahussein_0-1604512437225.png

 

Please advise. 

 

Thank you,

Aliya 

 

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @aliyahussein 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end. 

Table:

f1.png

 

Calendar(a calculated table):

Calendar = CALENDARAUTO()

 

Calculated column:

FY QTR = 
var m = MONTH([Date])
var y = YEAR([Date])
return
IF(
    m<7,
    SWITCH(
        TRUE(),
        m in {1,2,3},"FY "&y-1&" QTR3",
        m in {4,5,6},"FY "&y-1&" QTR4"
    ),  
    SWITCH(
        TRUE(),
        m in {7,8,9},"FY "&y&" QTR1",
        m in {10,11,12},"FY "&y&" QTR2"
    )
)
FY QTR Value = 
var m = MONTH([Date])
var y = YEAR([Date])
return
IF(
    m<7,
    SWITCH(
        TRUE(),
        m in {1,2,3},(y-1)*10+3,
        m in {4,5,6},(y-1)*10+4
    ),  
    SWITCH(
        TRUE(),
        m in {7,8,9},y*10+1,
        m in {10,11,12},y*10+2
    )
)

 

There is a relationship between two tables. Then you need to make 'FY QTR' sorted by 'FY QTR Value'.

f2.png

 

Result:

f3.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-alq-msft
Community Support
Community Support

Hi, @aliyahussein 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end. 

Table:

f1.png

 

Calendar(a calculated table):

Calendar = CALENDARAUTO()

 

Calculated column:

FY QTR = 
var m = MONTH([Date])
var y = YEAR([Date])
return
IF(
    m<7,
    SWITCH(
        TRUE(),
        m in {1,2,3},"FY "&y-1&" QTR3",
        m in {4,5,6},"FY "&y-1&" QTR4"
    ),  
    SWITCH(
        TRUE(),
        m in {7,8,9},"FY "&y&" QTR1",
        m in {10,11,12},"FY "&y&" QTR2"
    )
)
FY QTR Value = 
var m = MONTH([Date])
var y = YEAR([Date])
return
IF(
    m<7,
    SWITCH(
        TRUE(),
        m in {1,2,3},(y-1)*10+3,
        m in {4,5,6},(y-1)*10+4
    ),  
    SWITCH(
        TRUE(),
        m in {7,8,9},y*10+1,
        m in {10,11,12},y*10+2
    )
)

 

There is a relationship between two tables. Then you need to make 'FY QTR' sorted by 'FY QTR Value'.

f2.png

 

Result:

f3.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

You rock! thank you!!!!!

AlB
Community Champion
Community Champion

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors