Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
schuffe
Contributor III
Contributor III

differenc of profit and profit-planned

Hello ,

I need your help again 😛

I prepared some data:

Unbenannt.PNG 

 Unbenannt.PNG

Now I want to make a KPI that tells me the differenc of profit and profit planned.

But I dont want "Sum(Profit)-Sum(Profit planned)" (this would be +50 in this example), I need to calculate it in another way, like this: 

Unbenannt.PNG

That means: For each day and each group I compute the differenc of profit and profit planned, but if the profit is bigger than the profit planned, the differenc has to be zero. 

Long story short:

I need the sum of the differences over all Dates and groups, when the profit is less than planned.

Thanks in advance 🙂

1 Solution

Accepted Solutions
schuffe
Contributor III
Contributor III
Author

With the help of my last post i could solve this by myself :

sum(aggr(if(sum(Profit)-sum([Profit planned])>=0,0,sum(Profit)-sum([Profit planned])),Group,Date))

View solution in original post

1 Reply
schuffe
Contributor III
Contributor III
Author

With the help of my last post i could solve this by myself :

sum(aggr(if(sum(Profit)-sum([Profit planned])>=0,0,sum(Profit)-sum([Profit planned])),Group,Date))