Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Compare Value from last row value

rowid     value     arrow

1     1001    

2     999

3     504

-      1000

I need to show up and down arrow by comparing the value of blank row id with first row, second row and so on.....

I tried to implement the below calculation but not able to achieve it

if( sum([Value]) <= SUM({$-<rowid = {'?*'}>}[Value]),'qmem://<bundled>/BuiltIn/arrow_n_g.png','qmem://<bundled>/BuiltIn/arrow_s_r.png')

1 Solution

Accepted Solutions
sunny_talwar

I am not entirely sure what you are trying to do, but may be try this:

If(Sum([Value]) <= Sum(TOTAL {$-<rowid = {'?*'}>}[Value]), 'qmem://<bundled>/BuiltIn/arrow_n_g.png', 'qmem://<bundled>/BuiltIn/arrow_s_r.png')

View solution in original post

9 Replies
swuehl
MVP
MVP

Not sure about the (chart object) context you are trying to use this expression.

Maybe something like this (assuming '-' indicates a NULL in the rowid record)

Create a variable vThreshold like

=Sum({1<value = e({<rowid = {"*"}>}) >} value)

or (if it's in fact a '-' chararacter)

=Sum({1<rowid -= {'-'}>} value)

Do you get the correct value?

Then just use the variable in your expression:

if( sum([Value]) <= vThreshold

,'qmem://<bundled>/BuiltIn/arrow_n_g.png','qmem://<bundled>/BuiltIn/arrow_s_r.png')

Kushal_Chawda

Create the Variable on front end, vBlankRowId and put below expression

SUM({1-$<rowid = {'*'}>} Value)


then write expression

if( sum([Value]) <= $(vBlankRowId)

,'qmem://<bundled>/BuiltIn/arrow_n_g.png','qmem://<bundled>/BuiltIn/arrow_s_r.png')

Not applicable
Author

It's not working, increasing number of rows and adding blank rows.

sunny_talwar

I think you will might benefit using a technique similar to As-Of Table:

The As-Of Table

Alternatively, you might need to use Above/Before to achieve what you are looking for:

Missing Manual - Above() and Below()

ankit777
Specialist
Specialist

Hi

You need to create a variable like this

=sum(if(isnull(rowid),value,0))

Now use this in your expression:

if you name the variable as vColor

if( sum([Value]) <= $(vColor),'qmem://<bundled>/BuiltIn/arrow_n_g.png','qmem://<bundled>/BuiltIn/arrow_s_r.png')

Not applicable
Author

This does not compare the blank rowid with other values

Not applicable
Author

Can it be achieved by set, as need to only compare blank row id with the one's having value?

sunny_talwar

I am not entirely sure what you are trying to do, but may be try this:

If(Sum([Value]) <= Sum(TOTAL {$-<rowid = {'?*'}>}[Value]), 'qmem://<bundled>/BuiltIn/arrow_n_g.png', 'qmem://<bundled>/BuiltIn/arrow_s_r.png')

Not applicable
Author

Thanks, it worked!!!