in this video we're going to take a look at hierarchies
in power bi so we have this table that has calendar year and order quantity broken down
a very common scenario for a hierarchy might be a breakdown by year so let's say you want to
go from year to month to date all the way down and have it understand the different levels
now we can very easily just drag over calendar year month name and date and we would be able to
to drop down into it but a lot of times what happens is you have a scenario like that that
you're going to reuse over and over again so you don't want to have to constantly be dragging it
over and maybe you want to sort it a certain way that's where hierarchies come into play
let's create a hierarchy based on date and it's super easy we'll start with calendar
year at the top and let's put month name you just drag it on top of it
it creates a new option here called calendar year hierarchy and we can rename this if we want
and we'll just we'll call this date hierarchy calendar year account month name and let's add
date as well so let's drag this over and here we can see calendar year month month name and date
all in a row just as we want it let's get rid of date that's a little too specific for right now
now the first thing we notice here is the ordering it's actually in alphabetical order and the reason
is because this month name column is set in that order and we can change that for that column
by going to model and sort by column so the first thing let's actually remove this
from that hierarchy go to month name
and now this becomes active sort by column by default is the name so that's alphabetical order
but what we want is actually another column you can pick any other column in the model but we
know that we have one called month number of the year and just to show you what that looks like
you can see it goes one two three four five six seven eight nine and that is reflective of
the month name each has its own column but we want that in the hierarchy to be
in that order and really any time we use this column we want it in that order
so let's go to sort by column and instead switch this to month number of year so that
means anytime we use this column it's going to be in order of month number in the year
january february march april may great so let's add this back to the hierarchy
put it above calendar date because this is the order we want
and now we can see these are in order i'm going to flip this now we can see this is in order
from january february march and it's broken down for us
now if we go and flip this to a matrix this also becomes nice because in a matrix
you have the ability to actually drill down so if we go to the next level
this is already in place we want to add this level of the hierarchy
into our visual we can drill down to that as well if we go this option it will display it
one level down nested if you enable this it turns this into a clicking motion where
you can drill down into it otherwise it'll just highlight it with this selected it'll drill down
so dates are obviously a really common example of a hierarchy another one might
be with your products you know let's say we know that the order here would go category
and then model you just drag it up it creates this hierarchy model name and this sub category in here
so we have category subcategory model name color whatever you want you can add those in there
now at that point all it takes is one click and everything is in there in exactly the
right order in terms of hierarchy that you want we could call this product hierarchy
now let's say we want to add this the actual product name to it maybe this goes
at the top so that's how you would use this here it's pretty simple
and something that you'd likely use many times in a lot of different ways on your dashboards
especially as your models become a little bit more complicated and have a lot more columns
involved so as always thank you for watching hope you found this helpful leave a comment if you
have any questions like the video subscribe and i'll see you at the next one thank you