Sort per month in power bi

Asked

Viewed 1,301 times

1

I have an excel spreadsheet that gives me something like

Contrato      Jan/2018       Fev/2018       Mar/2018
2010100       15.800,00      9.000,00       15.000,00
2010101       10.000,00     10.000,50       11.000,15

Right after I made a unpivot of these data resulting in something like this

Contrato      Jan/2018       Fev/2018    Mar/2018     Attribute      Value
2010100       15.800,00      9.000,00    15.000,00    Jan/2018       15.800,00
2010100       15.800,00      9.000,00    15.000,00    Fev/2018        9.000,00
2010100       15.800,00      9.000,00    15.000,00    Mar/2018       15.000,00
2010101       10.000,00     10.000,50    11.000,15    Jan/2018       10.000,00
2010101       10.000,00     10.000,50    11.000,15    Fev/2018       11.000,15
2010101       10.000,00     10.000,50    11.000,15    Mar/2018       10.000,50

Soon after, I create a line Chart pulling as data the "Attibute and "Value", but only that the order of display is in alphabetical order and wanted to put in the orders of the months, as Jan/2018, Feb/2018 and Mar/2018

I’ve tried to go on Modeling and Sort by column but not in order of the month.

1 answer

2


Gabriel in this case can do the following.

Create an auxiliary table of 'TEMPO', in this table should contain your months/years (as they appear in your current table) and another column that can be called 'ORDER' for example.

More or less in this format:

inserir a descrição da imagem aqui

After that link this new table to its original table ( By DATE field)

Once this is done, you need to select the data menu in Powerbi, click on the 'DATA' column and then change the classification of the column to be sorted by another column (ORDER). As shown below:

inserir a descrição da imagem aqui

Once this is done, the powerbi will begin to sort the date column by 'ORDER' as you selected.

Just remembering that this column (DATA) has to be placed in your charts/tables, so that it obeys this ordering rule.

Important

The order column must be selected with the data type 'INTEGER' so that the ordering is done in the proper way.

Obs.:

This same process can be done in your current table by creating a custom column and assigning the order for each month/year respectively. For Voce this Voce can use some function DAX

  • Buddy, I ended up adopting a solution very similar to this, although I had already solved a while ago. Anyway I am deeply grateful for the time dedicated to writing this answer.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.