馃攳
Sorting months according your financial year in Power BI - YouTube
Channel: unknown
[0]
A common problem when working with
accounting data in power bi is to get
[3]
your months to sort correctly according
to your financial year instead of the
[7]
calendar year. In this example I'm
working with a company data set whose
[11]
financial year runs from the 1st of
April through to the 31st of March so
[15]
the order I want my months to be presented in would be from April through to March.
[20]
Of course by default power bi will display
your months starting from January and
[25]
going through to December. Let's have a
look at how we can change that to start
[29]
from April going through to March. In my
dataset we're going to look at at a
[35]
couple of tables I've got one table that
I've pulled in from Sage 50 which
[39]
contains my accounting periods as
defined in Sage 50. Let's take a quick
[43]
look at that data set. We have the
accounting period one through to twelve
[52]
We've got the period description so we can see
my fiscal or my financial year is
[57]
running from the 1st of April 2017
through to the 31st of March 2018 for
[63]
this current financial year. Separately
I've extracted the start of the period;
[68]
the end of the period; the number of days
in the period and the month number. So
[76]
April is month number four for example.
What we have now in my table is
[81]
accounting period 1 corresponds to month
number 4 and that's the key to resolving
[85]
this problem. How I extracted the startup
period end of period days in period from
[90]
this period description you can see in a
separate video. So that's my accounting
[95]
period table and I have a dates table
take a look at that I have my date and
[105]
this is just a set of continuous dates
incrementing one day at a time across my
[110]
entire dataset. So I have my date and
I've got a calculated column called
[115]
period which references my accounting
periods table and what I'm using is
[121]
lookup function and taking the month of
the date I'm referencing the month in
[125]
the accounting periods tables or the
month number and using that to look up
[129]
the corresponding accounting period and
writing that into my dates table. So
[132]
in my dates table and have the date and
the period for every single date in my
[137]
table. The next field I've created in my
dates table is a simple text field
[144]
displaying the months using three
characters. I'll just add that in then
[149]
I'll show you how I've done that and
I've used a very simple trick using the
[155]
format function within DAX and I've
created a dummy date of the first day of
[162]
the first year and then I've taken the
month of the date in the dates table
[167]
and then I have asked the format function to
format that as mmm format which just
[172]
gives me my Nov Dec Jan and so
on. So that gives me my months that I
[177]
want to display on my reports that
matches the the corresponding date and
[181]
if Igo back to the report, if I want to
create say for example sales by month
[186]
this year and last year I go to maybe
select a visualization for a bar chart
[190]
and I go to my measures and I have
some measures I prepared earlier so I
[199]
have sales this year I have sales last
year and I want to show that by month to
[206]
go to my dates table and here straight
away we can see the problem it's
[212]
presented because the month column is
now a text format column it has just
[218]
displayed that in ascending alphabetical
order. Now I want to reorder that
[221]
according to my financial year. So the
field that contains or the column within
[227]
my dates table that contains the order
the sort order that I want is my period
[231]
information. So to fix that is actually a
very simple trick within power bi. If I
[236]
go to my data view and select the
month column and then go to this sort
[244]
by button and by
default is sorting by itself the month
[249]
but instead I can choose it to sort by
the period. Now if I go back to my report
[255]
view what you see now is the data is
correctly sorted starting in April and
[259]
going through to March. It doesn't
just work for this visualization that's
[263]
now saved into the report it also works
for other visualizations as well so for
[267]
example if I wanted to add a slicer by
month, pop in the month there and you
[274]
can see the slicer is presenting the
months in the correct order. So that's a
[279]
very simple trick that you can use
within power bi to get your months to
[284]
sort according to your financial year
instead of the calendar year
Most Recent Videos:
You can go back to the homepage right here: Homepage





