Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
sass
Contributor
Contributor

Set Analysis : getfieldselections with date -1

Hello,

I am trying to get set analsyis to give me the day before selected day by user.

I tried this but it doesn't work...

Sum({<MasterCal.Day={"=$(=GetFieldSelections(MasterCal.Day))-1"}>} sales)

Can any one fix this please.

Labels (3)
6 Replies
asinha1991
Creator III
Creator III

getfieldselections return string

you need convert it to date, for example date#(GetFieldSelections(MasterCal.Day),'mm/dd/yyyy') 

format should be what your actual date format is

sass
Contributor
Contributor
Author

Thanks for the suggestion !

I have tried this :

Sum({<[MasterCal.Day]={"=$(=date#(GetFieldSelections([MasterCal.Day]),'mm/dd/yyyy')"}>} sales)

But it doesnt work...

asinha1991
Creator III
Creator III

can you try this

date#(GetFieldSelections([MasterCal.Day]),'mm/dd/yyyy') in a textbox and see what it returns?

maybe  GetFieldSelections([MasterCal.Day]) returns a date which is not in 'mm/dd/yyyy' format?

sass
Contributor
Contributor
Author

date#(GetFieldSelections([MasterCal.Day]),'mm/dd/yyyy') in a textbox return a correct date...

asinha1991
Creator III
Creator III

need to see whats wrong with set analysis then but you can give this a try in the mean time

 

 

Sum({<[MasterCal.Day]=}>} if({MasterCal.Day=date#(GetFieldSelections([MasterCal.Day]),'mm/dd/yyyy')-1,sales))

sass
Contributor
Contributor
Author

Doesn't work...

When I try this it works : 

Sum({<[MasterCal.Day]={'$(=GetFieldSelections([MasterCal.Day]))'}>} sales)

Sum({<[MasterCal.Day]={'$(=max([MasterCal.Day]))'}>} sales)

 

When I want to add -1, it doesn't work...

If anyone has a solution....