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

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

Reply
M_SBS_6
Helper V
Helper V

If dates logic power query

Hi, 

I have a calculated column that takes a date range and groups it into its own financial period. 

 

Switch(

True(), 

Test[date] >= date(2017,10,1) && test[date] <= date(2018, 04, 6), "17/18",

Test[date] >= date(2018,10,1) && test[date] <= date(2019, 04, 6), "18/19", blank()

)

 

Does anyone know how to recreate this logic in Power Query please using the Add Column? 

 

1 ACCEPTED SOLUTION
muhammad_786_1
Super User
Super User

Hy @M_SBS_6 

 

Yes, You can do it by using this code.

 

if [Date] >= #date(2017, 10, 1) and [Date] <= #date(2018, 4, 6) then "17/18"
else if [Date] >= #date(2018, 10, 1) and [Date] <= #date(2019, 4, 6) then "18/19"
else null

 

 

Best Regards,
Muhammad Yousaf

 

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

 

LinkedIn

View solution in original post

1 REPLY 1
muhammad_786_1
Super User
Super User

Hy @M_SBS_6 

 

Yes, You can do it by using this code.

 

if [Date] >= #date(2017, 10, 1) and [Date] <= #date(2018, 4, 6) then "17/18"
else if [Date] >= #date(2018, 10, 1) and [Date] <= #date(2019, 4, 6) then "18/19"
else null

 

 

Best Regards,
Muhammad Yousaf

 

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

 

LinkedIn

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.