# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
Not applicable

## complex calc in barchart

Hi comm,

i have a bar chart in which i want to show the ratio between sales and retoure of an article.

The article is the articlename plus the size. Its a combined Dimension btw.

My problem is that in the database every article is unique, so i have an articlenumber that unique and i need to do the calc over the articlenumber. But i cant show it in the chart cause its to big. Thats why i have articlename and size as dimension.

So i have sum of sales and sum of retoure like:

Sum({\$<[art_ret]= {'sale'}>} amount_RET) //same with retoure just change {'retoure'}

but i dont know how to aggr with my articlenumber when articlename and size are a dimension.

Hope someone can help, thanks in advance!!

-Eric

Tags (2)
1 Solution

Accepted Solutions
Not applicable

## Re: complex calc in barchart

i used an other coloum now and it works!!

mistake from me sorry for that!!!

12 Replies
Not applicable

## Re: complex calc in barchart

I am not sure that I understand your data - if every article is associated with a name and with a size, then your expression should work. To get the ratio, you would need:

=Sum({\$<[art_ret]= {'retour'}>} amount_RET) / Sum({\$<[art_ret]= {'sale'}>} amount_RET)

If that is not working then your data is nor organised the way I thought. You might want to provide extra information, preferably a small sample with some representative data the the chart that you are trying to build.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable

## Re: complex calc in barchart

the problem is that u can sell an article and retoure it and the same article can then be sold again.Thats why u need the articlenumbe rin calc!!

Not applicable

## Re: complex calc in barchart

Maybe it makes sense to create a "real field" in the data model instead of using calculated dimension.

Not applicable

## Re: complex calc in barchart

i dont calc the dimension.

sorry for my bad english but I want to calc this as my measure!

Not applicable

## Re: complex calc in barchart

I think i have a problem with my calc!!!

Sum({\$<[art_ret]= {'sale'}>} amount_RET)

This calc gives me the amount of both "retoure" and "sale" back but it should only give me the amount of "sale"!!

Someone see the problem with my syntax

Not applicable

## Re: complex calc in barchart

Eric is your data model well connected? If it isn't then that could be one of the reason that set analysis doesn't work. Would you be able to share a sample to further investigate this?

Not applicable

## Re: complex calc in barchart

the RET table is the only table and it is not connected

Not applicable

## Re: complex calc in barchart

RET table is the only table in your database? So you have just one table which includes all the fields?

Not applicable

## Re: complex calc in barchart

I am confused if [art_ret]= {'sale'} gives you sales and returns (retour). What does [art_ret]= {'retour'} give you?

I think you would be better off uploading a small sample app with some representative data.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Community Browser