Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello, I'm trying to calculate the relative margin for products which have a VAT H(igh) or L(ow) but it does nog give any result back, i think because i'm trying to take the sum of it all Qlikview does not understand what i want. This is the formula i am using
=((sum(
if(btwcode = {'H'},
{<date = {'$(=Date(today()-1))'} >} sales)/1.19)-(sum({<date = {'$(=Date(today()-1))'} >} inkoopprijs)))/(sum({<date = {'$(=Date(today()-1))'} >} sales)/1.19)
,
=((sum({<date = {'$(=Date(today()-1))'} >} sales)/1.06)-(sum({<date = {'$(=Date(today()-1))'} >} inkoopprijs)))/(sum({<date = {'$(=Date(today()-1))'} >} sales)/1.06)
)
Is the formula wrong or my approach?
I believe you are using an equal sign where it mustn't be placed (first letter, 6th line).
Then and more important, you are embedding aggregation functions into another aggregation function (sum into sum), which is not allowed without using advanced aggregation.
I think your then-else branches are also not as you intended.
To help you more with your syntax, could you describe a bit closer in what context you want to use your expression (e.g. in a table chart (with what dimensions?))? For example, is your data already grouped by btwcode?
I believe you are using an equal sign where it mustn't be placed (first letter, 6th line).
Then and more important, you are embedding aggregation functions into another aggregation function (sum into sum), which is not allowed without using advanced aggregation.
I think your then-else branches are also not as you intended.
To help you more with your syntax, could you describe a bit closer in what context you want to use your expression (e.g. in a table chart (with what dimensions?))? For example, is your data already grouped by btwcode?