SOLVED

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

Copper Contributor

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.

 

 

Elona105_0-1718368811957.png

Thank you!

3 Replies
best response confirmed by Elona105 (Copper Contributor)
Solution

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

 

0-SP.png

 

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:

 

1-JSON.png

 

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

 

1 best response

Accepted Solutions
best response confirmed by Elona105 (Copper Contributor)
Solution

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

 

0-SP.png

 

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:

 

1-JSON.png

 

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

 

View solution in original post