Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

X-Axis to show two data columns like Excel

Hello all, I have just started using PBi. I have a chart in Excel which shows two data values, the month and the population, it looks like this:     The way I acheive this is simply expandin...
  • dax's avatar
    dax
    6 years ago

    Hi Anonymous , 

    You could try to add two field in chart like below and create month date column by M code , then you could set sort by month date column.

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8krM0zW0VNJR0sizNTS11ASyDPRMzZRidaKV3FKTkOQsoHIWYDnfxCKEnJkxVM4cLOdYgCRnAtNnBNVXiWSmKVTOECznVYrkFjMDqJwxVC4HSQ6mTyk2FgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Month = _t, Population = _t, Rate = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{ {"Population", type text}, {"Rate", type number}}),
        #"Added Custom" = Table.AddColumn(#"Changed Type", "Month date", each "01-"&[Month]),
        #"Changed Type1" = Table.TransformColumnTypes(#"Added Custom",{{"Month date", type date}})
    in
        #"Changed Type1"

     Or you also could create a calculated column like below , then set sort by like above image

    Best Regards,
    Zoe Zhi

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.