Forum Discussion
christinaxxx
2 years agoHelper I
Getting wrong quarter in the date table
I have a calendar function for generating date table in Power Query: = (StartDate as date, EndDate as date, FYStartMonth as number) as table =>
let
DayCount = Duration.Days(Duration.From(EndD...
- 2 years ago
You are welcome! 🙂
Yes you have to add it. You can use the same code but you have to change "shortyear" to "QuarterOfYear"AddFY = Table.AddColumn(InsertShortYear, "FY", each "FY"&(if [MonthOfYear]>=FYStartMonth then Text.From(Number.From([ShortYear])+1) else [ShortYear]))
--> like something like this.
AddFY = Table.AddColumn(InsertShortYear, "FY", each "FY"&(if [MonthOfYear]>=FYStartMonth then Text.From(Number.From([QuarterOfYear])+1) else [QuarterOfYear]))
Let me know if you need more help.
andhiii079845
2 years agoSolution Sage
The date 1/04/2022 - first april of 2022, so Q2 should be right.
InsertQuarter = Table.AddColumn(InsertYear, "QuarterOfYear", each Date.QuarterOfYear([Date])),
This is correct to this line.
You have to check this line:
AddFY = Table.AddColumn(InsertShortYear, "FY", each "FY"&(if [MonthOfYear]>=FYStartMonth then Text.From(Number.From([ShortYear])+1) else [ShortYear]))
So look for column FY , only in this line FYStartMonth is used.
christinaxxx
2 years agoHelper I
Thank you! Yes the FY column is correct. Guess I need to add a quarter mapping then