Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
spcon2016
Partner - Contributor III
Partner - Contributor III

Set Analysis initial value reacts to user selection

Hi Community, 

I'm a bit confused because of the following, really simple looking example: The goal is to show total of current year value. User should be able to change value by selecting last year. 

Sales:
load * inline [
Year, Sales
2020,100
2019,99
2018,98
];

WasisThis.PNG

Why do I still see 100? I've expected 99.

 

Labels (2)
1 Solution

Accepted Solutions
lironbaram
Partner - Master III
Partner - Master III

 HI

it seems you are confusing 

set analysis from regular selections , 

set analysis is like making a selection on the field and it's disregarding other selection in the field 

in your case it doesn't matter what you'll choose in the year field it will always return 100 , because it's going to disregard the selection . 

in your case if you want the regular  behavior then you just use sum(Sales) , that way if you select a year you'll get this year result and if you don't select any year you'll get the total of all years , 

if you look for a solution to always display the max year from available years  you can use 

sum({<Year = {"$(=max(Year))"}>}Sales)

View solution in original post

1 Reply
lironbaram
Partner - Master III
Partner - Master III

 HI

it seems you are confusing 

set analysis from regular selections , 

set analysis is like making a selection on the field and it's disregarding other selection in the field 

in your case it doesn't matter what you'll choose in the year field it will always return 100 , because it's going to disregard the selection . 

in your case if you want the regular  behavior then you just use sum(Sales) , that way if you select a year you'll get this year result and if you don't select any year you'll get the total of all years , 

if you look for a solution to always display the max year from available years  you can use 

sum({<Year = {"$(=max(Year))"}>}Sales)