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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Different calculations on different rows in one table (straight or Pivot)

Hello all I have the next question.

In a QV application I have diiferent KPI's on Different sheets. My client wants one sheet with al those KPI's as start page. This will look like this (simplified);

error loading image

I have the problem that i want to use different formulas for the same expression in QV. Anybody a hint?

Thanks in advance!

1 Solution

Accepted Solutions
matt_crowther
Specialist
Specialist

A simple method would be to contain each formula within an 'if' based either on the dimension value or the rowno() value.

eg: if(rowno()=1,sum(sales),if(rowno()=2,count(Customers),sum(Sales)/count(Customers)))

Hope that helps,

Matt - Visual Analytics Ltd

View solution in original post

3 Replies
matt_crowther
Specialist
Specialist

A simple method would be to contain each formula within an 'if' based either on the dimension value or the rowno() value.

eg: if(rowno()=1,sum(sales),if(rowno()=2,count(Customers),sum(Sales)/count(Customers)))

Hope that helps,

Matt - Visual Analytics Ltd

Not applicable
Author

Found a solution;

Made a not linked tables with the KPI's, used one of this fields as dimension in the table. And then use an if function to calculate;

If (KPI_nr='1',

COUNT(<Period={$(=maxstring[PIT_Year]-1)}>X),

if(KPI_nr='2',

SUM(<Period={$(=maxstring[PIT_Year]-1)}>Y),

If(KPI_nr='3',

MAX(<Period={$(=maxstring[PIT_Year]-1)}>Y)

)

)

)

Not applicable
Author

Thanks Matt!!Yes