Forum Discussion

Elona105's avatar
Elona105
Copper Contributor
Jun 14, 2024
Solved

Display negative value in a column if a condition is meet in another column

Hello all,

 

Can you please help me? I have 1 column named Sales Activity that has several selection options and the other column MF/Line (ALL). When the user select in the Sales Activiy the condition Disconnecion the value in M.fee tab to be negative.

 

 

Thank you!

  • Elona105 so if this is your list and the monthly fee column is not formatted it looks like this:

     

     

    But if you format the column in advanced mode with the following JSON...

     

     

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
      "elmType": "div",
      "txtContent": "=if([$SalesActivity] == 'Disconnect', @currentField * -1, @currentField)"
    }

     

     

     

    ...then change one of the selections in the Sales Activity column to Disconnect the result looks like this:

     

     

    Rob
    Los Gallardos
    Microsoft Power Automate Community Super User.
    Principal Consultant, SharePoint and Power Platform WSP Global (and classic 1967 Morris Traveller driver)

     

3 Replies

    • Rob_Elliott's avatar
      Rob_Elliott
      Bronze Contributor

      Elona105 so if this is your list and the monthly fee column is not formatted it looks like this:

       

       

      But if you format the column in advanced mode with the following JSON...

       

       

      {
        "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
        "elmType": "div",
        "txtContent": "=if([$SalesActivity] == 'Disconnect', @currentField * -1, @currentField)"
      }

       

       

       

      ...then change one of the selections in the Sales Activity column to Disconnect the result looks like this:

       

       

      Rob
      Los Gallardos
      Microsoft Power Automate Community Super User.
      Principal Consultant, SharePoint and Power Platform WSP Global (and classic 1967 Morris Traveller driver)

       

Resources