Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
RodrigoAsa
Contributor II
Contributor II

I need help solving a problem with variables.

Sum({< 
    Bonificação = {'Não'},
    Ano = {'$(vAnoAnt)', '$(vAnoAnt)'}
>} [Faturamento Líquido - Preço de Venda])
 
/
Sum({< 
    Bonificação = {'Não'}, 
    Ano = {'$(vAnoAnt)', '$(vAnoAnt)'}
>} total <Ano> [Faturamento Líquido - Preço de Venda])

 

I'm trying to create an expression using only one measure, but the graphical measures become incorrect when I insert variables from different years.

vAnoAnt = Last Year

vAnoAtual = Today Year

Ano = Year

The others values are not important.

Labels (1)
  • Other

1 Solution

Accepted Solutions
rubenmarin

Hi, yes, I don't see why it would go over 100%, maybe something about rounding values or the conversion between decimal values converted to binary values and added up.

I would try to copy the chart and change it to table to understand what's behind those values, keeping the % and adding numerator and denominator in different expressions.

I would try first a table with only Ano as dimension to check if it shows the 100%, and check the values. Then adding the categories, check than the total values are the same, and adding more decimals to the expression, ecporting the values and checking if the values added up sums 100% or it's really an higher value.

 

View solution in original post

4 Replies
rubenmarin

Hi, I suppose one of the vAnoAnt in "Ano = {'$(vAnoAnt)', '$(vAnoAnt)'}" it's really a vAnoAtual.

When you set the expression, in the text box below there is an expanded expression hat show how all the $( are converted in values. It's converted as expected?

If you change the $(vAnoAnt) and $(vAnoAtual) by fixed values (like '2025', '2026'), it works? IF it works it's something about how vAnoAnt and vAnoAtual are defined. If not, it's something about the expression itself, not the variables.

Another thing: you're using TOTAL <Ano>, and that will have meaning if Ano is one of the dimensions,a nd in that case, the dimension will filter the expression, so each year will only return data for that year, as the dimension it's applying his value as filter.

I think it will be better if you show the table with the dimensions used and what do you expect for each year.

RodrigoAsa
Contributor II
Contributor II
Author

Captura de tela 2026-03-23 110924.png

Can you see the %? 
The percentage cannot exceed 100%, because this is a participion table.

Sum({< 
    Bonificação = {'Não'},
    Ano = {'$(vAnoAtual)', '$(vAnoAnt)'}
>} [Faturamento Líquido - Preço de Venda])
/
Sum({< 
Bonificação = {'Não'}, 
    Ano = {'$(vAnoAtual)', '$(vAnoAnt)'}
>} total <Ano> [Faturamento Líquido - Preço de Venda])

I know there are no error in my data upload, but I don't know where is the error.
Asking your question "If you change the $(vAnoAnt) and $(vAnoAtual) by fixed values (like '2025', '2026'), it works?" 
Yeah, the result is the same, the  values of the variables are correct!
I tried doing other things, like table settings. 

The dimensions are: Ano (main dimension), Categoria(secondary) and the alternatives dimensions (Sub Categoria, Grupo)

rubenmarin

Hi, yes, I don't see why it would go over 100%, maybe something about rounding values or the conversion between decimal values converted to binary values and added up.

I would try to copy the chart and change it to table to understand what's behind those values, keeping the % and adding numerator and denominator in different expressions.

I would try first a table with only Ano as dimension to check if it shows the 100%, and check the values. Then adding the categories, check than the total values are the same, and adding more decimals to the expression, ecporting the values and checking if the values added up sums 100% or it's really an higher value.

 

RodrigoAsa
Contributor II
Contributor II
Author

I did everything and the values ​​are 100% within the normal table.
Thank you for help!