Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I would like to make a set analysis which define fields that will not be responsive to selection and at the same time in the set analysis define fields who will be responsive to selection.
I mean, for example
I have a graph with two columns which allow comparaison between two years
( first column is about the data of the year of selection and the second column is about data of the previous year of the selection ) [ so if the user choosed 2019 it will be about 2019 and 2018 ]
For that I use two variables that I use in the graph :
=num(GetFieldSelections(Year)) => v_SelectedYear
=num(GetFieldSelections(Year))-1 => v_SelectedYearPreviousOne
And in the graph as expression I use set analysis ( with selector 1 otherwise i can't have data of the last year cause data will be responsive of selection )
- For current year :
num( (sum({1<Month={'dec.'}>*1<Year={$(=(v_SelectedYear))}>*1<[Contract]-={'DA','IT','}>} FinMois*FLAG*alt([Int],0)/100)) ,'# ##0,00',',',' ')
- For previous year of selection :
num( (sum({1<Month={'dec.'}>*1<Year={$(=(v_SelectedYearPreviousOne))}>*1<[Contract]-={'DA','IT'}>} FinMois*FLAG*alt([Int],0)/100)) ,'# ##0,00',',',' ')
But if i do that, the selector 1 make ALL fields irresponsive, so if i want to keep the possibility of have the current year of selection and the previous year of the selection, the user can't make a selection for other field for example to see the data only of one country.
I tried to put a *$<Country>-={''}> but i have eventually understood that if we put a 1 in a set analysis it make ALL fields irresponsive in the set analysis and we can't have multiple identificators .
Do i miss something ?
Thanks for reading
I think your approach is much more complex as needed. I think I would use either something like this (simplified for demo purpose):
sum({< Field = {'x'}, Year = {"$(=max(Year))"}>} Value)
sum({< Field = {'x'}, Year = {"$(=max(Year)-1)"}>} Value)
by using two expressions within the chart which didn't contained Year as dimension or
sum({< Field = {'x'}, Year = {">=$(=max(Year)-1)<=$(=max(Year))"}>} Value)
as single expression by including Year as dimension.
- Marcus
Thanks for response but after test it's the same problem for previous year
If i put this set analysis : sum({< Field = {'x'}, Year = {"$(=max(Year)-1)"}>} Value)
cause $ is the identifier by default, the data which are shown are going to depend of the selection.
So if the user choose 2020, it is not gonna work cause the selection is data of 2020 but the set analysis select data of 2019.
So it is gonna select nothing cause data of 2020 and those of 2019 are different.
The solution would be to make the same set analysis: sum({< Field = {'x'}, Year = {"$(=max(Year)-1)"}>} Value)
But with 1 identifier.
But in this case, the user can't select anything ( about other field for example countries )
EDIT : that's why if wanted to know if it was possible to make a set analysis which make a field irresponsive of any selection made ( so the year is irresponsive of any selection, if the user choose 2020, it still select 2019 )
But that the other field depends of the selection of the user ( for example country )
It's not quite clear for me what your issue is. In many scenarios the above mentioned approaches will fulfill their purpose. By a selection of 2020:
sum({< Field = {'x'}, Year = {"$(=max(Year))"}>} Value)
returns the values for 2020. We could also just apply it as:
sum({< Field = {'x'}>} Value)
as we don't need the year-condition within the set analysis and the following:
sum({< Field = {'x'}, Year = {"$(=max(Year)-1)"}>} Value)
returns the values for 2019 because the set analysis statement for the year overwrites the document-selection.
Beside of this you could of course ignore and/or overwrite any selection with an appropriate set analysis. Ignoring some fields is quite simple with something like this:
sum({< Field = {'x'}, Year, Month, Week, Date>} Value)
and you may also use 1 as identifier like:
sum({1< Field = {'x'}>} Value)
but the last could become more expensive if not all selections should be ignored else only certain ones. In general you need to specify everything explicitly what should not be responsible to the normal selections.
Recommended is to apply any conditions only there where they are mandatory needed for special views and everything else should react directly on the selections. It doesn't only lead to less efforts for the UI development else also to a better user-experience.
- Marcus
Thanks again for responding , so I think my problem is different, with the same set analysis you gave me for the previous year and if I choose for example 2020 as user selection ( forced selection ) I have an empty column for the data of previous year ( 2019 in that case )
So i suppose that in my document the selection of user overwrites the set analysis , could that be possible ?
EDIT : Eventually, i have understood my problem, i did exactly as you said at it was perfect.
My problem was that i used * as operator of intersection like num( (sum({$<Mois={'déc.'}>*$<Année={"$(=max(Année))"}>*1<[Contrat - Type Code]-={'DA','IT','ST','DP'}>} FinMois*ZY00.FLAG_ETP*alt([Int. Soc. - Taux],0)/100)) ,'# ##0,00',',',' ')
But when i don't use intersection and i only use , like sum({< Field = {'x'}, Year, Month, Week, Date>} Value)
it perfectly works
But i don't understand clearly the difference between both ?
Thanks a lot, now it works perectly !
Indeed your approach is different. I will try to clarify:
{< Field1 = {'x', 'y'}, Field2 = {'z'}>}
is a single set analysis whereby the values of x and y by Field1 are connected with the operator OR and the connection between Field1 and Field2 is AND.
If you now apply:
{< Field1 = {1} > * < Field2 = {1} >}
you have two set analysis conditions. In this case they are linked per * which means AND. Both statements are independent to each other unless of their intersection. This means your year-condition within one set analysis worked only there and the other set analysis are further responsible to any year-selections.
In this regard you should consider multiple set analysis conditions as a higher level of set analysis as the single one and of course each additionally level leads to a higher complexity. Therefore try to keep it as simple as possible and implementing such approaches only if you really couldn't get the wanted results with a lower level set analysis.
- Marcus
@Suyo wrote: quickpayportal
Hello,
I would like to make a set analysis which define fields that will not be responsive to selection and at the same time in the set analysis define fields who will be responsive to selection.
I mean, for example
I have a graph with two columns which allow comparaison between two years
( first column is about the data of the year of selection and the second column is about data of the previous year of the selection ) [ so if the user choosed 2019 it will be about 2019 and 2018 ]For that I use two variables that I use in the graph :
=num(GetFieldSelections(Year)) => v_SelectedYear
=num(GetFieldSelections(Year))-1 => v_SelectedYearPreviousOne
And in the graph as expression I use set analysis ( with selector 1 otherwise i can't have data of the last year cause data will be responsive of selection )
- For current year :
num( (sum({1<Month={'dec.'}>*1<Year={$(=(v_SelectedYear))}>*1<[Contract]-={'DA','IT','}>} FinMois*FLAG*alt([Int],0)/100)) ,'# ##0,00',',',' ')
- For previous year of selection :
num( (sum({1<Month={'dec.'}>*1<Year={$(=(v_SelectedYearPreviousOne))}>*1<[Contract]-={'DA','IT'}>} FinMois*FLAG*alt([Int],0)/100)) ,'# ##0,00',',',' ')
But if i do that, the selector 1 make ALL fields irresponsive, so if i want to keep the possibility of have the current year of selection and the previous year of the selection, the user can't make a selection for other field for example to see the data only of one country.
I tried to put a *$<Country>-={''}> but i have eventually understood that if we put a 1 in a set analysis it make ALL fields irresponsive in the set analysis and we can't have multiple identificators .
Do i miss something ?
Thanks for reading
Beside of this you could of course ignore and/or overwrite any selection with an appropriate set analysis. Ignoring some fields is quite simple with something like this: sum({< Field = {'x'}, Year, Month, Week, Date>} Value)