Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum in Expression : For Pivot Table

Hi,

I have a pivot table which looks like

City                    Zipcodes                    NumberOfRestaurant               Expression

                             111111                              250                              550

Rockford               111111                             300                                 550 

                            111113                              400                              600

                             111113                              200                              600

                                111111                              100                              100

indiana                   111112                              200                              200

I am looking to get the sum of each city and the zipcodes in the city.

So the answer should be as shown in the expression above

Under Expresson I tried

Sum(Total<City, Zipcodes>, NumberofRestaurant)

Any suggestions pls.

Thanks

10 Replies
Gysbert_Wassenaar

Try Sum(Total<City, Zipcodes> NumberofRestaurant). See attached example.


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks

This for some reason is not working for me.

Gives me a different number.

My actual expression syntax looks like

if(City like 'Indiana*', sum(total<city,Zipcodes>Numberofrestaurant))

I am not sure why.

Not applicable
Author

Thanks for replying.

Still I see the same wrong numbers.

All this formula looks right and the attached qvw also looks good.

Not sure why I am getting the wrong numbers.

er_mohit
Master II
Master II

Where you get the wrong result

if you try like this way

if(City like 'Indiana*', sum(total<city,Zipcodes>Numberofrestaurant))

to get this

try

if(City ={'Indiana*'}, Aggr(NODISTINCT Sum(NumberOfRestaurant),Zipcodes,City))

Not applicable
Author

This is giving Error in formula.

Not applicable
Author

Thanks for your reply.

This still gives the same wrong numbers.

Not applicable
Author

I absolutely understand that the formula are right.

This is what is happening with me.

I have data which is loaded from the qvd file.

Here I am creating a pivot table and applying the formula in the expression . And the numbers coming out are WRONG.

But If I export this data to excel and load this data into new qvw and reapply the same formula in the expression it works like a charm.

So I know that the formula is right.

This I dont understand is how come for the same pivot tht I am doing froma QVD file why are the numbers coming wrong.

Has anyone seen issues like this ?

er_mohit
Master II
Master II

See the attached file not sure why your data comes different when you load it from qvd

but in my File it comes true

See the attached file

make sure that in sort tab your all data is in ascending order

Not applicable
Author

Thank you.

I see your file and yes it works as expected.

But same formula on my qvw does not work.

It still gives me wrong numbers.

It seems to be giving me numbers which are lot bigger than what it should be.

I have read lot of article cant figure out why.

There is some calculations which are getting multiplied or .

I will keep digging there has to be some explanation for what I am seeing.

Thanks