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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
kutty1989
Contributor II
Contributor II

Average

You can see a formula in the attached picture. 

The result should be 0,45% 

But somehow it is -1,36% 

Any idea why?

 

kutty1989_0-1620992332733.png

 

7 Replies
rubenmarin

Hi, hard to say without seeing a few rows of data. Try filtering 2-3 rows of data and post the data filtered for the fields used in expression.,the expected value and the value it returns.

kutty1989
Contributor II
Contributor II
Author

kutty1989_0-1621240833499.png

In the attached table you can see the row, I test my formula

 

rubenmarin

Hi, but in that one the result is the expected 0,45% so nothing wrong to see there. You need at least 2 rows to see the effect of the avg compared to what you expect.

kutty1989
Contributor II
Contributor II
Author

kutty1989_0-1621246156955.png

Sorry. I was trying in the meanwhile.

I found two issue. 

1. If I put the "1-" before avg it is ok in case I filter to only one row. If I delete the filter and see more rows, the result will be empty.

2. I tried to see formula step by step. Until the last step the furmula works well. The last number make the result wrong. I cannot understand why

rubenmarin

Hi, if the result at some point is null that will mean that it has 2 difffernt value for the same row. Maybe beacuse the % is set in another table and the relation is 1-N.

You can try to add the filter as dimensions, and applying/removing filters you can see if any combination of dimensions goes to different % values wich will lead to the engne to don't know wich value to pick and therefore returning a null value.

kutty1989
Contributor II
Contributor II
Author

As you have seen, I filtered my datas to only one row. The calculation result is wrong with only one row. I attached prevousy

kutty1989
Contributor II
Contributor II
Author

Solved. The problem was the relations between the tables.