SUM of Positives and SUM of Negatives from the same row

Dear Support Forum members,

My data file has columns showing different discount rates by type of discount/markup applied on a single line in a sales order. Each row indicates a line in an order with a specific material. I would like to calculate two “calculated columns” - one showing a sum of positive values and one showing a sum of negative values since there will be multiple rates applied on one line depending on different categories. I am not able to figure out a DAX formula without having to create a negative and positive for each type of rate and then summing them up in 2 calculated columns. One other thing just to be clear - a single column i.e. one type of discount can have positive and negative values.
Test_Disc_Positive_Negative.xlsx (11.0 KB)

Hi @a_nimish

Create a calculated columns like below.


Positive and Negative.pbix (27.3 KB)

1 Like

@a_nimish

Here is another approach using Table constructor

Positive and Negative.pbix (28.5 KB)

Hope this is helpful.

1 Like

@a_nimish

Here is the simple solution using variables

Positive and Negative.pbix (30.2 KB)

Thank you so much, Rajesh. Very helpful! I understood the simple solution using variables, but I didn’t quite follow the other two. Is there any reading material to understand the solution you have created with calculated column (UNION method)?

1 Like

@a_nimish

For each row, creating a table like below using UNION and ROW

To sum only Positive apply filter on Check = Positive.

image

Second Solution: Creating the same table using Table Constructor.
When we create Table using Table Constructor first column is Value1 and Second Column is Value2…

Hope this clarifies.

Hello @a_nimish! Welcome to the forum :slight_smile: It’s great to know that you are making progress with your query.

Please don’t forget if your question has been answered within the forum it is important to mark your thread as ‘solved’.

We request you to kindly take time to answer the Enterprise DNA Forum User Experience Survey, We hope you’ll give your insights on how we can further improve the Support forum.

Hello @a_nimish, it’s been a while since we got a response from you.

Just following up the information the experts requested above so they can help you further.

Please be reminded that In case there won’t be any activity on it in the next few days, we’ll be tagging this post as Solved.

Hi @a_nimish, due to inactivity, a response on this post has been tagged as “Solution”. If you have any concern related to this topic, you can create a new thread.