Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
marygrace
New Contributor III

Count data from yesterday and today

Hi

I have one question.

I need to count data *Orders from yesterday and today. I tried to do with the bellow sentence

Previous day

Count({<Date = {"$(=Date(Max(Date) - 1,)"}>} OrderNumber)

+

Today

Count({<Date = {"$(=Date(Max(Date)"}>} OrderNumber)

Does not woks

Please help me

1 Solution

Accepted Solutions
MVP
MVP

Re: Count data from yesterday and today

Count(

     {$

          <Date={"$(=Date(max(Date),'DD/MM/YYYY'))"}, Flag={0},Year=,Week=,Month=>

          +

          <Date={"$(=Date(max(Date)-1,'DD/MM/YYYY'))"}, Flag={1},Year=,Week=,Month=>

     }

     distinct OrderNumber)

View solution in original post

11 Replies

Re: Count data from yesterday and today

May be this

Count({<Date = {"$(='>=' & Date(Today() - 1, 'M/D/YYYY') & '<=' & Date(Today(), 'M/D/YYYY'))"}>}OrderNumber)

marygrace
New Contributor III

Re: Count data from yesterday and today

Hi Sunny,

It is works, Now I would like to see the same information, selecting, Year, Month, Week. It is possible to Count Date (today) + PrevDay (yesterday) value with diferents selections.

The measurment Counts all orders released before 16: 40hrs, identified Flag = 1, after 16: 40hrs Flag = 0, So I need to count all orders released today Flag = Flag = 1 Today + Flag = 0 Yesterday) through time.

I hope to be clear.

Thanks!

Re: Count data from yesterday and today

So you don't want to look at Today and Yesterday's value... you want Max selected date and max selected date -1 day value? May be this

Count({<Date = {"$(='>=' & Date(Max(Date) - 1, 'M/D/YYYY') & '<=' & Date(Max(Date), 'M/D/YYYY'))"}, Year, Month, Week>}OrderNumber)

marygrace
New Contributor III

Re: Count data from yesterday and today

Yes, I need to Count Yesterday Flag=0 + Today Flag=1.

this measurment returns the count for today

Count({<Date = {"$(='>=' & Date(Max(Date) - 1, 'DD/MM/YYYY') & '<=' & Date(Max(Date), 'DD/MM/YYYY'))"}, Year, Month, Week>} distinct Numero_OrdenVenta)

Re: Count data from yesterday and today

Not sure I understand? Did it work?

marygrace
New Contributor III

Re: Count data from yesterday and today

No really, it return the count for Orders today, my idea is to have

Count Orders Today Flag = 1 + Count Orders Yesterday Flag =0

Count({<Date = {"$(='>=' & Date(Max(Date) - 1, 'DD/MM/YYYY') & '<=' & Date(Max(Date), 'DD/MM/YYYY'))"}, Year, Month, Week>} distinct Numero_OrdenVenta)

Khan_Mohammed
Honored Contributor II

Re: Count data from yesterday and today

if(InDay(Date ,today(),0),1,0) as TodayFlag,

if(InDay(Date ,today(),-1),1,0) as YesterdayFlag,

Above 2 statements in your script

and in front end maybe

Count({<TodayFlag={1}>} distinct Numero_OrdenVenta) + Count({<YesterdayFlag={0}>} distinct Numero_OrdenVenta)


Not sure if this would work....

MVP
MVP

Re: Count data from yesterday and today

Count(

     {$

          <Date={"$(=Date(max(Date),'DD/MM/YYYY'))"}, Flag={0},Year=,Week=,Month=>

          +

          <Date={"$(=Date(max(Date)-1,'DD/MM/YYYY'))"}, Flag={1},Year=,Week=,Month=>

     }

     distinct OrderNumber)

View solution in original post

marygrace
New Contributor III

Re: Count data from yesterday and today

Hi Massimo,

It´s works!!! when you select specific Date I mean '23/10/2017'.

In case select by week, month, Year, does not works.

I am missing something?

Thank you so much!