Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
ajit_aarya
Contributor II
Contributor II

Matching with today date

I want to sum up the costs of today . I has a fields Cdate and amount. 

 

Sum( if(match(Cdate= Date(Now()) ), amount))

 

Here i am matching Cdate (my field) equals to Date(now()). If it matches then i need total  amount ( using sum)

 

Its not working, Can i use date now as a expression or is there any alternative for this expression???

Labels (2)
2 Replies
Or
MVP
MVP

Several things wrong with this one..

1) Match compares strings, and doesn't take an equal sign.

2) There's a Today() function if you're not interested in the time aspect of now()

3) You'd need Dayname() (or floor()) rather than Date() to get rid of the time aspect

If you'd like to keep a similar syntax, you could use

Sum(if(Cdate = Today(),amount))

sidhiq91
Specialist II
Specialist II

@ajit_aarya  Please see the code below to calculate the sales for today()

Back end in the script:

NoConcatenate
Temp:
Load Date(Date#(CDate,'MM/DD/YYYY'),'MM/DD/YYYY') as CDate,
Amount
Inline [
CDate, Amount
07/28/2022, 100
07/28/2022, 100
07/29/2022, 100
07/29/2022, 100
07/29/2022, 100
07/29/2022, 100
07/29/2022, 100
07/30/2022, 100
];

Total:
Load Sum(Amount) as Total_Cost,
CDate
Resident Temp
where CDate=Today()
group by CDate;

drop table Temp;

Exit Script;

Front End Expression: Sum(if (CDate=today(), Amount))