Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

yesterday's sales

Hi Experts,

I m trying to calculate yesterday sales value in a textbox.

My expression is

num(sum({<[Full Date]={'$(=max(date([Full Date]-1)))'},[DeliveryFlag]={1}>} Sales),'#,##0')

but i m getting 0. is anything wrong in my expression?

can someone please help?

1 Solution

Accepted Solutions
Gysbert_Wassenaar

WTD:  {<[Full Date] = {">=$(=Date(WeekStart(Max([FullDate])),'DD/MM/YYYY')))<$(=Date(Max([FullDate]),'DD/MM/YYYY'))"} >}

MTD:  {<[Full Date] = {">=$(=Date(MonthStart(Max([FullDate])),'DD/MM/YYYY')))<$(=Date(Max([FullDate]),'DD/MM/YYYY'))"} >}

YTD:  {<[Full Date] = {">=$(=Date(YearStart(Max([FullDate])),'DD/MM/YYYY')))<$(=Date(Max([FullDate]),'DD/MM/YYYY'))"} >}


talk is cheap, supply exceeds demand

View solution in original post

10 Replies
Gysbert_Wassenaar

Put the date() function around the max() function and make sure to use the correct date format.


num(sum({<[Full Date]={"$(=date(max([Full Date]-1),'MM/DD/YYYY'))"},[DeliveryFlag]={1}>} Sales),'#,##0')

MM/DD/YYYY is just an example. Use whatever format the field [Full Date] actually has.


talk is cheap, supply exceeds demand
Not applicable
Author

thank you gysbert.

can you please help me on WTD, MTD & previous YTD expressions?

Gysbert_Wassenaar

WTD:  {<[Full Date] = {">=$(=Date(WeekStart(Max([FullDate])),'DD/MM/YYYY')))<$(=Date(Max([FullDate]),'DD/MM/YYYY'))"} >}

MTD:  {<[Full Date] = {">=$(=Date(MonthStart(Max([FullDate])),'DD/MM/YYYY')))<$(=Date(Max([FullDate]),'DD/MM/YYYY'))"} >}

YTD:  {<[Full Date] = {">=$(=Date(YearStart(Max([FullDate])),'DD/MM/YYYY')))<$(=Date(Max([FullDate]),'DD/MM/YYYY'))"} >}


talk is cheap, supply exceeds demand
sunny_talwar

Shouldn't we use WeekStart for WTD?

WTD:  {<[Full Date] = {">=$(=Date(WeekStart(Max([FullDate])),'DD/MM/YYYY')))<$(=Date(Max([FullDate]),'DD/MM/YYYY'))"}>}

Gysbert_Wassenaar

Yeah, you're right.


talk is cheap, supply exceeds demand
Not applicable
Author

gysbert,

this expression is working only when a date is selected.

i want this to be displayed even there is no date selection.

Not applicable
Author

sunny,

this is not giving required value.

i cant see anything wrong in the expression.

Gysbert_Wassenaar

The expressions can't be used in a table where you use Full Date as dimension. For that you need to create an As-Of table in the script to create a new field that can be used instead as chart dimension. See this blog post: The As-Of Table. Only instead of using months as periods you need to use days. Every day has to be linked with every day before it.


talk is cheap, supply exceeds demand
Not applicable
Author

i found the error gysbert.

it was the misplace of round bracket.

its working fine.

thank you so much