Forum Discussion

sportive92003's avatar
sportive92003
Icon for Helper II rankHelper II
9 months ago
Solved

DAX in a new column

Hello,

I have added a new column to categorize my products. You can see my catecories (description_categorie). I have a categorie named "Total" (N=27 476) and "Total (frais)" N=11 425). My category "Total" should be 16 051 (27 425 - 11 425). How to get this result without changing the name of my column (Descrition_categorie) as I ha ve in many graphs I don't want to change them.

 

 

  • Hi sportive92003,

     

    Thank you for reaching out to Microsoft Fabric Community.

     

    Thank you 123abc and MasonMA for the prompt response. 

     

    As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided by the user's for the issue worked? or let us know if you need any further assistance.

     

    Thanks and regards,

    Anjan Kumar Chippa

11 Replies

  • v-achippa's avatar
    v-achippa
    Icon for Community Support rankCommunity Support

    Hi sportive92003,

     

    Thank you for reaching out to Microsoft Fabric Community.

     

    Thank you 123abc and MasonMA for the prompt response. 

     

    As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided by the user's for the issue worked? or let us know if you need any further assistance.

     

    Thanks and regards,

    Anjan Kumar Chippa

  • 123abc's avatar
    123abc
    Icon for Community Champion rankCommunity Champion

    You don’t need to rename your existing column; you can handle this with a DAX measure or a calculated column that adjusts the value for “Total” without changing the original category names.

  • Hi,

     

    Can i ask how you added this 'new column to categorize products'? If this was created by DAX or Power Query, i'd suggest maybe fixing the logic in that column so “Total” no longer includes “Total (frais)” items? This avoids needing an adjustment measure altogether.

    • sportive92003's avatar
      sportive92003
      Icon for Helper II rankHelper II

      Yes, I click on transform Data and ADD A COLUMN

      Show in another way (I cut a long part as it's all the same programmation): 

       

      = Table.AddColumn(#"Valeur remplacée", "Personnalisé", each if Text.Contains([description], "BLC-1500 LAVE-GLACE BIO") then "Antigel - produits chimiques" else if [description] = "URÉE" then "Urée" else if [description] = "UREE" then "Urée" else if Text.StartsWith([description], "TOTAL") then "Total" else if Text.StartsWith([description], "ATS") then "ATS" else if [description] = "HUILE A FORME ISO 55" then "Envirolub" else if Text.StartsWith([description], "ENVIROLIN") then "Envirolin" else if [description] = "FRAIS DE TRANSPORT LUBRIFIANTS" then "Total (frais)" else "À VOIR")

       

      The results concern amount, Profit and Volume