How to calculate SUM of TotalPrice?

Hello,

I am developing application for mobile. I have database GetExpenses, where I have attributes (Name, Date, Quantity, Price, and I calculated TotalPrice => as Quantity*Price). It is in the 1st and 2nd picture.

My problem is, that I need to calculate TotalPriceSum, but when i will do this, I wiill get errors, as you can see in the next pictures and I lost Expense with my attributes. (picture 3 and 4th). 

So, only 1 thing, which I need is to callate SUM(TotalPrice). Can you help me, how to do it?

Sorry, for my English and thank you for your help in advance.


https://www.photobox.co.uk/my/photo/full?photo_id=502370375666   1st picture

https://www.photobox.co.uk/my/photo/full?photo_id=502370377215   2nd picture

https://www.photobox.co.uk/my/photo/full?photo_id=502370376650   3rd picture

https://www.photobox.co.uk/my/photo/full?photo_id=502370375320  4th picture


Jakub


Hello Jakub,


I cannot see the pictures on the link, but getting SUM can be performed in an aggregate by right-clicking the target column and select Sum.


Hope this helps!

- Emman

John Emmanuel Si wrote:

Hello Jakub,


I cannot see the pictures on the link, but getting SUM can be performed in an aggregate by right-clicking the target column and select Sum.


Hope this helps!

- Emman

Hi, I uploaded photos again, here you will see it I hope :) Unfortunately, It does not help me to solve my problem.

https://imgur.com/22aD1Y8 1st picture

https://imgur.com/3XFok7C 2nd picture

https://imgur.com/LJBfB7o   3rd picture

https://imgur.com/yjBPOcD  4th picture


But Thank you for help


Hello Jakub,


Best practice for this scenario is to use 2 aggregates; first one does 1st to 2nd pic and second one does 1st to 3rd pic.


Another solution would be to manually sum TotalPrice after your current aggregate, but that takes more load for your screen which is not good.


Hope this helps!

- Emman

Hi,

I saw the images and got a solution for it. The reason for not showing the other record is, you are using the same aggregate to calculate and show all the data. when you do a Groupby or count Operation, then only that data will show as a result output. to show all the record you have to create another aggregate for it to show the other results for it. If you send me the OML file I can able send you updated one, 

Please send me the OML. Waiting for your valuable response,

Thank you,

Sudip

Sudip Dey wrote:

Hi,

I saw the images and got a solution for it. The reason not to showing the other record is, you are using the same aggregate to calculate and show all the data. when you do an Groupby or count Operation, then only that data will show as a result output. to show all the record you have to create another aggregate for it to show the other results for it. If you send me the OML file I can able send you updated one, 

Please send me the OML. Waiting for your valuable response,

Thank you,

Sudip

HI, I am sending my OML file.

Jakub

Hi Jakub,

Please check the attached  Updated OML file. I hope it is done as per your requirements. Waiting for your Valuable response,

Thank you,

Sudip

Solution

Please check the updated one as an attachment OML. Waiting for your response.


Thank you,

Sudip

Solution

Hi,

If you want to be sure that the total amount displayed in the screen is the sum of the displayed lines, you must iterate trough your list and sum the line values.

Two different queries can retrieve the data from different subsets of data, since while you're querying data can be modified in the DB.


Cheers,

Tiago.

Sudip Dey wrote:

Please check the updated one as an attachment OML. Waiting for your response.


Thank you,

Sudip

Hi,

Thank you very much for your help. It works, as I need. You helped me a lot.


Jakub