Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
camilo
Contributor III
Contributor III

Creating a value to show the % participation

Hi, I would like to create a field that shows every line of my balance as a sales percentage, for example:

Account    Real  % of Sales

Sales        200         100%

Costs         -40          -20%

Total            60           30%

I´m trying to create an expression "% of Sales" like this:

=sum(Real)/(Sum( {$<[Account]={Sales}>} Real))

But I just get this:

Account    Real  % of Sales

Sales        200         100%

Costs         -40                   

Total            60           30%

In the DB, both Sales and Costs are in the same column (Account).

Thanks for your help!!

19 Replies
camilo
Contributor III
Contributor III
Author

I´m using this, but the result is the same(got the same values):

=sum(Real)/(Sum(total<Month>{$<[Cuenta Resu]={'Sales'}>} Real))


Thanks

swuehl
MVP
MVP

Just to be sure, 'Month' is your month field name? Because every field else is named in spanish...

Could you post a small sample application here?

camilo
Contributor III
Contributor III
Author

You are right I translated some words trying to make it more understandable Month is my Month field name, the exact line right now is:

=sum(Real)/(Sum( total{$<[Cuenta Resu]={'Ventas'}>} Real))

This line gives me the Sales participation percentage of every line and works fine when I have the information agregated.

Now I would like to use the variable Month to separate de data on Months columns. I did this and it looks fine but a closer look you can see that the sales (and all the other fields separated by moths) are being divided by the total sales not just the month sales wich result on a smaller participation % than what should be.

I´m attaching a sample app, hope is clear enough

Thanks,

Camilo

swuehl
MVP
MVP

So this is not what you want to see?

Mes112233
CuentaRealSales %RealSales %RealSales %
Costo113043,3%11027,5%9825,8%
Costo23010,0%6015,0%7720,3%
Ventas300100,0%400100,0%380100,0%
camilo
Contributor III
Contributor III
Author

Yes that is what I want to see!

swuehl
MVP
MVP

Yes - this is not what you want or yes - it is?

This is my expression:

=sum(Real)/(Sum( total<Mes> {$<Cuenta={'Ventas'}>} Real))

Looks similar to what I suggested before, doesn't it

camilo
Contributor III
Contributor III
Author

Stefan,

How can I create that table???

Thanks,

Camilo

camilo
Contributor III
Contributor III
Author

Yes that is what I want !!

Sorry I didn´t see you had already answered, I try your solution but it doesn´t show any data...

swuehl
MVP
MVP

Here you are, I justed added the <Mes> after total in % expression.

camilo
Contributor III
Contributor III
Author

It works perfectly!! I had an error on a variable.

Thanks Stefan!

Camilo