Forum Discussion

Thiagops's avatar
Thiagops
Icon for Helper II rankHelper II
2 years ago
Solved

Classificar Por Coluna

Boa noite,

Preciso fazer uma CLASSIFICAÇÃO POR COLUNA na coluna CP_FUNC_INS_DTHR (2)

 

Para isso criei uma coluna índice, la no power query, porem aparece o seguinte erro:

 

Verifiquei e na coluna INDICE que o power query gerou automaticamente não possui itens repetidos, mas mesmo assim o erro continua. Alguma consegue me ajudar?

 

Em resumo, a coluna CP_FUNC_INS_DTHR (2) se refere a data de inclusão do pedido e preciso que ela fique em ordem crescente na segmentação de dados em que foi inserido. Atualmente esta desconfigurada (Esta deixa em ordem de dia, mas não esta respeitando o mês), conforme imagem abaixo:

Grato

 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Thiagops ,

     

    This is the raw data I created for testing.

    Date

    Sales

    2023/2/10

    100

    2023/2/8

    250

    2023/2/6

    150

    2023/2/2

    200

     

    Make sure that the 'CP_FUNC_INS_DTHR (2)' column is in the correct date format.

     

    In Power Query, you can use the 'Transform' > 'Data Type' > 'Date' function to ensure that the column is being treated as a date.

     

    Also in Power Query, you can try sorting the column directly before loading the data into the model.

     

    Select the column 'CP_FUNC_INS_DTHR (2) ', and choose 'Sort Ascending'.

     

    Create a index column in Power Query:

     

    After loading the data into the template, you can define the sorting of the 'CP_FUNC_INS_DTHR (2) ' column using the 'Sort by Column' functionality.

     

    Select the 'CP_FUNC_INS_DTHR (2) ' column in the fields panel, go to the 'Column Tools' tab and choose 'Sort by Column', selecting the index column you created.

     

    The pbix file is attached.

     

    For more details, please see the documentation:

    Sort one column by another column in Power BI - Power BI | Microsoft Learn

     

    If you can't solve it, can you provide me with the pbix link? Please do not log in to your account in Power BI Desktop when uploading pbix files.

     

    I hope this information helps to solve the problem. I'm happy to answer any further questions you may have.

     

    Best Regards,
    Yang
    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Thiagops ,

     

    This is the raw data I created for testing.

    Date

    Sales

    2023/2/10

    100

    2023/2/8

    250

    2023/2/6

    150

    2023/2/2

    200

     

    Make sure that the 'CP_FUNC_INS_DTHR (2)' column is in the correct date format.

     

    In Power Query, you can use the 'Transform' > 'Data Type' > 'Date' function to ensure that the column is being treated as a date.

     

    Also in Power Query, you can try sorting the column directly before loading the data into the model.

     

    Select the column 'CP_FUNC_INS_DTHR (2) ', and choose 'Sort Ascending'.

     

    Create a index column in Power Query:

     

    After loading the data into the template, you can define the sorting of the 'CP_FUNC_INS_DTHR (2) ' column using the 'Sort by Column' functionality.

     

    Select the 'CP_FUNC_INS_DTHR (2) ' column in the fields panel, go to the 'Column Tools' tab and choose 'Sort by Column', selecting the index column you created.

     

    The pbix file is attached.

     

    For more details, please see the documentation:

    Sort one column by another column in Power BI - Power BI | Microsoft Learn

     

    If you can't solve it, can you provide me with the pbix link? Please do not log in to your account in Power BI Desktop when uploading pbix files.

     

    I hope this information helps to solve the problem. I'm happy to answer any further questions you may have.

     

    Best Regards,
    Yang
    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!