# QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Announcements
If you are a Qlik Insight Bot user, join this collaborative group: JOIN GROUP
New Contributor III

## Advanced Set Analysis - Percent of rows with negative slope

Hello all,

I'm trying to show a percentage of patients where the slope of their line (using LINEST_M) is negative.

I'm really struggling with the syntax I need to use for the set analysis -- I believe what I have is somewhat close:

count(

{<PAT_ID = {"\$(=LINEST_M(ALL_VL_VALUE,ALL_VL_DATE_DIFF) <0}">}PAT_ID)

This is the numerator -- it should count the patients (PAT_ID) where the result of the LINEST_M equation is negative

/count(ALL_VL_VALUE)

This is the denominator -- should be fine the way it is.

In essence, I'm sure my numerator syntax is off, but I have a hell of a time figuring out what I need to do in what order with the dollar sign expansion.  Any and all help would be appreciated.

Thanks!

Tags (3)
1 Solution

Accepted Solutions
Highlighted
MVP

## Re: Advanced Set Analysis - Percent of rows with negative slope

May be misplaced double quote? and an extra dollar sign expansion....

Count({<PAT_ID = {"=LINEST_M(ALL_VL_VALUE,ALL_VL_DATE_DIFF) < 0"}>} PAT_ID)

5 Replies
Highlighted
MVP

## Re: Advanced Set Analysis - Percent of rows with negative slope

May be misplaced double quote? and an extra dollar sign expansion....

Count({<PAT_ID = {"=LINEST_M(ALL_VL_VALUE,ALL_VL_DATE_DIFF) < 0"}>} PAT_ID)

Highlighted
New Contributor III

## Re: Advanced Set Analysis - Percent of rows with negative slope

Unfortunately not, that throws me the same error: Error: Error in set modifier ad hoc element list: ',' or ')' expected

Highlighted
New Contributor III

## Re: Advanced Set Analysis - Percent of rows with negative slope

That edit did it -- I think...stand by.

Highlighted
New Contributor III

## Re: Advanced Set Analysis - Percent of rows with negative slope

I believe you got it -- thanks for the SUPER fast response!

Highlighted
MVP

Super