Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
HAmzehAF
Partner - Creator
Partner - Creator

Date

Hello, 

so im trying to do a stock control sheet and to get that i want a bar chart with today stock and -30 days stock 

bu everytime i try to get the -30 days stock i keeps giving me the whole stock i have 
my set analysis for this is : 
Sum({<Date = {"<$(=Date(Today() - 30))"}>} Stock * WAC)

also i tried to do it in the data load as
IF(Date = Date(Today() - 30), 1, 0) AS Is30DaysAgo,


im i doing smothing wrong cuz i tried like everything i only get 0 or the all stock, i just want to get the stock before 30 days for any of the dates i have when the user pick on it will go to that date 

 

22 Replies
MeehyeOh
Partner - Creator
Partner - Creator

@HAmzehAF 

I found the cause!!!

Since you using Date as a dimension, it doesn't come out in the same row.

 

MeehyeOh_0-1699516865235.png

Create a field called Date2 that is the same as Date but only has a different name

(It will be not used on the select Or visualization)

and put it in the set analysis.
And add Date= in set analysis.

MeehyeOh_1-1699517059728.png

 

reply! thanks!

 

HAmzehAF
Partner - Creator
Partner - Creator
Author

@MeehyeOh thank you again, 

but i didnt work still same thing i did everything 

HAmzehAF_0-1699518912997.png

 

MeehyeOh
Partner - Creator
Partner - Creator

@HAmzehAF 

 

How about creating a new column from a script?

If the [Date] column is a date type, make the value before the last 30 days, as in the script below.

 

e.g.)

TMP:
LOAD
    "DATE",
    "Month",
    "Week",
    Session_Count
FROM [lib://AttachedFiles/71a0a371-ea36-4748-a7d4-3b4b55574dce.xlsx]
(ooxml, embedded labels, table is Sheet1);
 
Left Join(TMP)
Load
    DATE+30 As DATE,
    Session_Count As LAST30SESSION
Resident TMP;
 
I tested it and it looks more simple.
 
OR!!!!
Use it as a variable!!
 
Make an expression that returns the value you want a variable.
(Is it the value of just before 30 days ago, right?)
Then add the variable as a measure!
 
e.g.
working expression(30 days ago) : Sum({<DATE = {"$(=Date(Max(DATE)-30,'M/D/YYYY'))"}>} Session_Count)
vLast30 :  =Sum({<DATE = {"$(=Date(Max(DATE)-30,'M/D/YYYY'))"}>} Session_Count)
A measure in table : $(vLast30)
 
Reply, thanks!
 
 
 
Reply, thanks!