1 2 Previous Next 21 Replies Latest reply on Oct 24, 2018 12:45 AM by Mahfooj Khan

# Calculated Field Not Working Properly

Hi Community,

I have Calculated the profit for Consumer only  which is "1" (Name of the calculated Field) and then I have another one for Corporate  which is "2"

and then I have calculated their Difference which i have named "2-1"  which is coming perfectly when i am putting it in text in a blank sheet,

But what i want is to show that "2-1" in Consumer but the result which I'am getting is not Correct it should show "-65,294".

So I'am facing a problem in this Can somebody Help me please!?

Kashish

• ###### 1. Re: Calculated Field Not Working Properly

Hi Kashish,

To get -65294 you have remove segment from view. Because in 1 and 2 calculations you are specifically getting values only for the segments. If you calculated the same in overall segment level you should the desired result

• ###### 2. Re: Calculated Field Not Working Properly

Hi Akram

I am not getting your answer can you show me in superstore dataset?

Because i want to show the difference under consumer only.

Thanks

Akram

• ###### 3. Re: Calculated Field Not Working Properly

Hi

2-1 Calculation:

With having segment on the view we are not getting the expected result

After removal of segment from the view we get the desired result

• ###### 4. Re: Calculated Field Not Working Properly

Hi Akram,

What you are doing is right but I want this result in Segment only for Consumers that is my Requirement.

Thanks

Kashish

• ###### 5. Re: Calculated Field Not Working Properly

Then you can achieve this by row grand total

Now Hide all segments and rename Grand Total as Consumer

The final result will be like this

• ###### 6. Re: Calculated Field Not Working Properly

Hi Akram,

Thanks But i want Corporate and Home office also like

I want that difference in place of that "0" under Consumer

Thanks

Kashish

• ###### 7. Re: Calculated Field Not Working Properly

Hi,

Is that what you wanted?

[1]: IF [Segment]="Consumer" THEN [Profit] ELSE 0 END

[2]: IF ATTR([Segment])="Consumer" THEN LOOKUP(SUM([Profit]),1) ELSE 0 END

[2-1]: [2]-SUM([1])

Let us know if this help.

Mahfooj

2 of 2 people found this helpful
• ###### 8. Re: Calculated Field Not Working Properly

Hi Mahfooj,

Thank you so much it is exactly what I wanted But i needed the profit for Corporate and Home Office as it is

Like

If [Segment]='Consumer' then ([2]-Sum([1])) else [Profit] End

But as I'am using Sum so it is giving error.

Consumer  Corporate  HomeOffice

-42,140       91,979       60,299

this is what i want see if you can help and thanks i was not able to get -42,140

Thanks

Kashish

• ###### 9. Re: Calculated Field Not Working Properly

Hi,

Modify the formula [2]: IF ATTR([Segment])="Consumer" THEN LOOKUP(SUM([Profit]),1) ELSE SUM([Profit]) END

Then you'll be able to see

Hope this will help.

Mahfooj

1 of 1 people found this helpful
• ###### 10. Re: Calculated Field Not Working Properly

Hi,

Right Click on Calculated Filed make it Avg and check the answer. Reply if it is Correct or Helpful for you.

Thanks,

Amar D. Savale.

• ###### 11. Re: Calculated Field Not Working Properly

Hi Mahfooj,

if i use your (2-1) then it is not working in my next formula which is

IF [Order Date]= DATEADD('day', -1,today()) then (2-1) End

It is giving me that aggregated error this is the last question please help me with this Mahfooj

Thanks

Kashish

• ###### 12. Re: Calculated Field Not Working Properly

Hi Mahfooj,

I have to give that "2-1" for yesterday which is DATEADD('day',-1,today())

Thanks

Kashish

• ###### 13. Re: Calculated Field Not Working Properly

Hi,

Try this, create a calculated field and put it in filter shelf

Hope this helps you to find the solution of your all questions then you may close the thread by marking my replies as correct/helpful. So, that it may help others who have similar question and this thread gets complete and hide from unanswered list.

Mahfooj

• ###### 14. Re: Calculated Field Not Working Properly

Hi Mahfooj,

I want this in one calculated field like

IF [OrderDate] = DATEADD('day',-1,Today()) then "[2-1]" End like this

because I have one more Calculated field with which i want to subtract this

So please if you can help me with this i know I'am bothering you alot But I'm stuck I'm not getting to my destination.