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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Period table according to financial year

I have created a period table for a slicer and would like to use data according to my financial year.  My financial year month is 7 and below is the table power query.

 

Can someone please advise what field I should change to get the 1Y, 2Y and 3Y data according to the Financial year not the calendar year?

 

 

let


TodaysDate = Date.From(DateTimeZone.FixedUtcNow()),

Ranges = {

{"All Dates",MinDates,MaxDates, 1},
{"6M", Date.AddMonths(TodaysDate, -6), TodaysDate, 3},
{"13M", Date.AddMonths(TodaysDate, -13), TodaysDate, 4},
{"YTD", Date.From(Date.StartOfYear(TodaysDate)), TodaysDate, 5},
{"1Y", Date.AddYears(TodaysDate, -1), TodaysDate, 6},
{"2Y", Date.AddYears(TodaysDate, -2), TodaysDate, 7},
{"5Y", Date.AddYears(TodaysDate, -5), TodaysDate, 8}
},
fxCreatePeriodTabe = ( PeriodName as text, StartDate as date, EndDate as date, SortOrder as number ) as table =>
let
DayCount = Duration.Days(EndDate-StartDate)+1,
DateList = List.Dates(StartDate,DayCount,#duration(1,0,0,0)),
AddPeriodName = List.Transform(DateList, each {PeriodName,_,SortOrder}),
CreateTable = #table( type table[Period=text, Date=date, Sort=number], AddPeriodName)
in
CreateTable,

GetTables = List.Transform(Ranges, each fxCreatePeriodTabe(_{0}, _{1}, _{2}, _{3})),
Output = Table.Combine(GetTables)
in
Output

2 REPLIES 2
Anonymous
Not applicable

I agree with you as I need a mix of periods to see the result for the last 6 or 13 months with YTD, 1Y, 2Y and 3Y as a Financial year.

lbendlin
Super User
Super User

You are basing your ranges off of "TodaysDate" so it is irrelevant when your fiscal year starts. Maybe you want to redefine what 1Y, 2Y and 3 (5?) Y means for you.

 

The only range that seems to be impacted is "YTD".  There you need to change Date.StartOfYear  to point to July instead of January.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

Top Solution Authors
Top Kudoed Authors