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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
TorieO
New Member

Custom quarter column

Hi guys I need help with these dates, running into a hitch with the query to add a column

 

Q1 - 11/18/2022- 2/18/2023

Q2- 2/17/2023- 5/17/2023

Q3- 5/18/2023- 8/17/2023

Q4 8/18/2023-11/17/2023

 

Quarter =
let
Date = [Date],
Q1Start = #date(2022, 11, 18),
Q2Start = #date(2023, 2, 18),
Q3Start = #date(2023, 5, 18),
Q4Start = #date(2023, 8, 18)
in
if Date >= Q1Start and Date < Q2Start then "Q1"
else if Date >= Q2Start and Date < Q3Start then "Q2"
else if Date >= Q3Start and Date < Q4Start then "Q3"
else "Q4"

 

 

 

Getting errors.
 
Thanks for your help!
 
 
3 REPLIES 3
TorieO
New Member

Thanks guys, I think it had to do with how I wrote the code. I just copied and pasted and it worked.

wdx223_Daniel
Community Champion
Community Champion

= let
  Date = [Date],
  OffsetMonths=2,
  OffsetDays=-17
in "Q"&Text.From(Date.QuarterOfYear(Date.AddDays((Date.AddMonths(Date,OffsetMonths)),OffsetDays)))

m_dekorte
Resident Rockstar
Resident Rockstar

Hi @TorieO ,


What is the error you are getting?

If that is something along the lines of "Can not convert a value of datetime to date" then, extract the Date first before applying your logic.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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.

Top Solution Authors