Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Values different in Graph and Table

Hello,

I have a problem where a bar graph and a table returns different output. Anyone has any idea why?

I have attached a qvw file where you can see the problem. The two objects are identical except for the chart type, so if you switch the graph to a table you get the values in the table and the other way around.

My ambition is to present the values in the table in the form of a bar chart.

Thank you very much!

/Fredrik

1 Solution

Accepted Solutions
johnw
Champion III
Champion III

Above() behaves differently in pivot charts vs. other kinds of charts. Above() finds the row above within the same column segment. In your pivot table, the column segment definition corresponds to what we see visually, so the segment includes all records with the same company. In any other table, the column segment includes all records with the same value for every dimension except for the last one. Since you have the Date occuring before the Company, the column segment ends up being only a single record. That makes above() return null, and since you use above() on every row but the first, every row but the first is null.

In a sense, this is simple to fix - just reverse the order of the dimensions. That does indeed get the right values in the bars. Unfortunately, it also really messes up the display, and I'm not sure how to fix it.

Anyway, knowing what's wrong is at least a good first step.

And as a side note, while this doesn't fix anything, this is how I write expressions that need above. A rangesum substitutes 0 for null, so it keeps you from having to check if you're on the first row.

rangesum(sum(FD_DimInput.BookedVal*_Report_CurrYTDYear*_GrossProfit*_Actual),
-above(sum(FD_DimInput.BookedVal*_Report_CurrYTDYear*_GrossProfit*_Actual)))

View solution in original post

3 Replies
prieper
Master II
Master II

Cannot find the difference, but suggest to delete the table and to convert the copy the graph and to convert to new table

Peter

johnw
Champion III
Champion III

Above() behaves differently in pivot charts vs. other kinds of charts. Above() finds the row above within the same column segment. In your pivot table, the column segment definition corresponds to what we see visually, so the segment includes all records with the same company. In any other table, the column segment includes all records with the same value for every dimension except for the last one. Since you have the Date occuring before the Company, the column segment ends up being only a single record. That makes above() return null, and since you use above() on every row but the first, every row but the first is null.

In a sense, this is simple to fix - just reverse the order of the dimensions. That does indeed get the right values in the bars. Unfortunately, it also really messes up the display, and I'm not sure how to fix it.

Anyway, knowing what's wrong is at least a good first step.

And as a side note, while this doesn't fix anything, this is how I write expressions that need above. A rangesum substitutes 0 for null, so it keeps you from having to check if you're on the first row.

rangesum(sum(FD_DimInput.BookedVal*_Report_CurrYTDYear*_GrossProfit*_Actual),
-above(sum(FD_DimInput.BookedVal*_Report_CurrYTDYear*_GrossProfit*_Actual)))

Not applicable
Author

Thank you very much for your help!