Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I'm replicating a report that is created within Excel. In their Graph, they are showing information on a bar graph showing information by the hour. I have the graph working fine calculating data.
I have the column for Hour formatted like this:
Solved! Go to Solution.
Let's assume we have this sample data
let
Source = {7..18},
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "Hr_Nr"}}),
#"Added Custom" = Table.AddColumn(#"Renamed Columns", "Hour", each Time.ToText(#time([Hr_Nr],0,0),"h tt")),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom", each Number.RandomBetween(1,10))
in
#"Added Custom1"
Once you load it in Power BI you can make a visual from it
Note that it is sorted by value. Let's sort it by hour instead (ascending)
which gives this:
Now, the last step is to employ the "Sort a column by another column" feature. Let's sort hour by hr_nr.
And that's the result:
Let's assume we have this sample data
let
Source = {7..18},
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "Hr_Nr"}}),
#"Added Custom" = Table.AddColumn(#"Renamed Columns", "Hour", each Time.ToText(#time([Hr_Nr],0,0),"h tt")),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom", each Number.RandomBetween(1,10))
in
#"Added Custom1"
Once you load it in Power BI you can make a visual from it
Note that it is sorted by value. Let's sort it by hour instead (ascending)
which gives this:
Now, the last step is to employ the "Sort a column by another column" feature. Let's sort hour by hr_nr.
And that's the result:
This worked great. I ended up creating a "sort" column translating 7 -> 0 through 6 -> 23 and then sorting by that. it worked great.
I like this. Would it work for a 24-hour day where it's 7am - 6am? looping over midnight?
I thought about creating a sort column which would make 7 = 0 and increment but that works until I get to 23 and then hours 0-6 are negative numbers.
Although, I may have something there.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 40 | |
| 38 | |
| 36 | |
| 29 | |
| 28 |
| User | Count |
|---|---|
| 127 | |
| 88 | |
| 78 | |
| 66 | |
| 65 |