Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
fbi
Contributor III
Contributor III

set analysis find date number of days before today's date

Hello everybody!

a question from a beginner;

I'm trying to write a set analysis that retreive  a price (Pris) based on the reseller (Återförsäljare) and date (Datum) where the date is number of days before today's date:

Example: today is the 3rd of march and I want to get the price having the date 27th february and reseller "Bygma"

fbi_0-1677855077870.png

this is what I wrote:

fbi_1-1677855145370.png

and here is how I dowload data:

fbi_2-1677855214706.png

thanks a lot in advance for all kind of help

 

 

 

Labels (3)
2 Solutions

Accepted Solutions
tresesco
MVP
MVP

Try putting single quotes around date value like:

Datum={'$(....)'}

View solution in original post

fbi
Contributor III
Contributor III
Author

sorry, this is the right print screen

fbi_3-1678091000138.png

 

View solution in original post

9 Replies
BrunPierre
Partner - Master
Partner - Master

Hello, It seems that the format of your dates is not the same.

Datum={$(=Date(Today()-4, 'YYYY-MM-DD'))}

Channa
Specialist III
Specialist III

you can simply do this

=date(today()-4)

this will return MM/DD/YYYY

also check the data formate of this column "Datum" 

if "Datum" is not in MM/DD/YYYY then change it in load script

like Date(Date#(Datum,'YYYY-MM-DD'),'MM/DD/YYYY')

Channa
Gabbar
Specialist
Specialist

this would work if you correct the date format as mentioned in previous comments,

but is price  available for all dates or just when prices changes there is a entry like price changed on 1st feb and then on 1st march and you want price of 27th feb then the price of first feb is to be shown?

fbi
Contributor III
Contributor III
Author

Hello thank you for your promt reply,

If I write the date format YYYY-MM-DD I get following error message

fbi_0-1678089407323.png

fbi_1-1678089509098.png

 

 

tresesco
MVP
MVP

Try putting single quotes around date value like:

Datum={'$(....)'}

fbi
Contributor III
Contributor III
Author

sorry, this is the right print screen

fbi_3-1678091000138.png

 

BrunPierre
Partner - Master
Partner - Master

Similar to @tresesco's suggestion, but with double quotes.

Datum={"$(=Date(Today()-4, 'YYYY-MM-DD'))"}

tresesco
MVP
MVP

Of course, since the single quotes are already there with date formatting. Good catch.

fbi
Contributor III
Contributor III
Author

Thank you very much, now it works! 😀