Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Highlighted
Not applicable

What is wrong with my date set expression

Hi guys,

I can't get set expressions working with dates. e.g. Show me only row counts for first day of last month.

Capture.PNG

The column is calculated as:

Count({<Date={"$(=date(MonthStart(today(),-1)),'DD/MM/YYYY')"}>}ID)

I would expect to see values in the 2nd and 4th row, but instead I see 0 for every row. The date format seems to match (as you can see in KPI indicator). The data model is super simple:

Load

ID,

date(date#(date, 'YYYY-MM-DD'), 'DD/MM/YYYY') as [Date],

date(date#(activation_date, 'YYYY-MM-DD'), 'DD/MM/YYYY') as [Activation Date];

Select

ID,

cast(created as date) as date,

cast(activation_date as date) as activation_date

from table;

What am I doing wrong?

7 Replies
rittermd
Honored Contributor

Re: What is wrong with my date set expression

I would try displaying the entire expression to get the first day of the month just to confirm that you are still getting what you expect.

date(MonthStart(today(),-1)),'DD/MM/YYYY')

Re: What is wrong with my date set expression

May be try this

Count({<Date={"$(=Date(MonthStart(Today(), -1), 'DD/MM/YYYY'))"}>} ID)

sadasiva
Contributor II

Re: What is wrong with my date set expression

Hi,

better create a variable for that and use it in the expression.

Regards,

Sadasiva

Re: What is wrong with my date set expression

Error in your expression, ')' is missing for $()

Count({<Date={"$(=date(MonthStart(today(),-1)),'DD/MM/YYYY')"}>}ID)


Change it to below


Count({<Date={"$(=date(MonthStart(today(),-1),'DD/MM/YYYY'))"}>}ID)

Re: What is wrong with my date set expression

Cheating karta hai meri

Re: What is wrong with my date set expression

samjana chahiye na bhai

Re: What is wrong with my date set expression

Hahahaha

Sahi bolta hai tu