Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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???
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))
@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))