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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Graph axis to appear as data appears in graph, not sorted alphabetically

Hello,

 

I am hoping that someone can help me figure out how to essentially prevent PowerBI from applying ANY sorting while creating a graph. It's automatically sorting the data on my axis alphabetically, and only giving me the options to sort alphabetically in ascending or descending order... I don't want any sorting applied whatsoever, but for it to appear on the axis in the order it appears in the table so that you can see how numbers were affected chronologically through the periods within a year, from year to year.

 

For example, the data in my data appears as P1 - 2019, P2- 2019, P3 - 2019, P1 -  2020, P2 - 2020, P3 - 2020, etc.  but is graphing as P1 - 2019, P1 - 2020, P2 - 2019, P2 - 2020, etc.

1 ACCEPTED SOLUTION

@Anonymousyou can easily do that transformation in pqwry

 

let
    Source = {1..12},
    #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Added Prefix" = Table.TransformColumns(#"Converted to Table", {{"Column1", each "P" & Text.From(_, "en-US"), type text}}),
    #"Added Suffix" = Table.TransformColumns(#"Added Prefix", {{"Column1", each _ & "-2019", type text}}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Added Suffix", "Column1", Splitter.SplitTextByDelimiter("-", QuoteStyle.Csv), {"Column1.1", "Column1.2"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Column1.1", type text}, {"Column1.2", Int64.Type}}),
    #"Replaced Value" = Table.ReplaceValue(#"Changed Type","P","",Replacer.ReplaceText,{"Column1.1"}),
    #"Added Custom" = Table.AddColumn(#"Replaced Value", "Custom", each if Text.Length([Column1.1])<2 then Text.From([Column1.2])&"-"&Text.PadStart([Column1.1],2,"0") else Text.From([Column1.2])&"-"&[Column1.1])
in
    #"Added Custom"

 

Capture.PNG

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

That gives me the option to create a custom column with a formula, but this isn't a calculated set of data. I'm not sure how I would make that work.

@Anonymous 

you need to create a calculated column for

the data in my data appears as P1 - 2019, P2- 2019, P3 - 2019, P1 -  2020, P2 - 2020, P3 - 2020, etc.

so that it appears as

2019-01, 2019-02, 2019-03

and use that column in your viz axis

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
Anonymous
Not applicable

I understand that, but am very new to PowerBI. I'm looking at equation documentation but do not know how to quickly/cleanly create that without having to write a replacement equation for every single cell. If you have any resources, it would be much appreciated.

@Anonymousyou can easily do that transformation in pqwry

 

let
    Source = {1..12},
    #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Added Prefix" = Table.TransformColumns(#"Converted to Table", {{"Column1", each "P" & Text.From(_, "en-US"), type text}}),
    #"Added Suffix" = Table.TransformColumns(#"Added Prefix", {{"Column1", each _ & "-2019", type text}}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Added Suffix", "Column1", Splitter.SplitTextByDelimiter("-", QuoteStyle.Csv), {"Column1.1", "Column1.2"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Column1.1", type text}, {"Column1.2", Int64.Type}}),
    #"Replaced Value" = Table.ReplaceValue(#"Changed Type","P","",Replacer.ReplaceText,{"Column1.1"}),
    #"Added Custom" = Table.AddColumn(#"Replaced Value", "Custom", each if Text.Length([Column1.1])<2 then Text.From([Column1.2])&"-"&Text.PadStart([Column1.1],2,"0") else Text.From([Column1.2])&"-"&[Column1.1])
in
    #"Added Custom"

 

Capture.PNG

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
smpa01
Super User
Super User

@Anonymous  you need to create a custom column for X axis as 2019-01, 2019-02, 2019-03 .....for power bi to show the axis in that order

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors