Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
mttconseil
New Contributor

What is wrong with my set analysis

Hello,

I would like to calculate the sales of today.

For that, I have :

- a variable vToday which contains the today's date,

- DateId which is my time dimension

I have tried the following formula with no success :

Sum( {$<DateId={$(vToday)}>} VAT_FREE_TOTAL_AMOUNT_NET)

Do you have any idea why my formula does not work?

Thank you in advance,

MT

1 Solution

Accepted Solutions
jfkinspari
Contributor III

Re: What is wrong with my set analysis

You might need to include single plings, as the date is a string

Sum( {$<DateId={'$(=Date(vToday,'DD/MM/YYYY'))'}>} VAT_FREE_TOTAL_AMOUNT_NET)

7 Replies

Re: What is wrong with my set analysis

One thing I would ask you to check is if vToday has the same date format as DateId. Can you share some information on how DateId looks and what does vToday displays in a text box?

Best,

Sunny

MVP
MVP

Re: What is wrong with my set analysis

Check the format of your variable, it must match the DateId field format.

Use Date() function if you need to format your date format of your variable, or num() if DateId is a number:

Sum( {$<DateId={$(=Date(vToday,'MM/DD/YYYY'))}>} VAT_FREE_TOTAL_AMOUNT_NET)

Sum( {$<DateId={$(=num(vToday))}>} VAT_FREE_TOTAL_AMOUNT_NET)

mttconseil
New Contributor

Re: What is wrong with my set analysis

Hello,

Thanks for your answers !

DateId is a date field --> 20/07/2015

I tried your formula with no success :

- Sum( {$<DateId={$(=Date(vToday,'MM/DD/YYYY'))}>} VAT_FREE_TOTAL_AMOUNT_NET)

- Sum( {$<DateId={$(=Date(vToday,'DD/MM/YYYY'))}>} VAT_FREE_TOTAL_AMOUNT_NET)

- Sum( {$<DateId={$(=Date(vToday))}>} VAT_FREE_TOTAL_AMOUNT_NET)

I also tried with no success :

- Sum( {$<DateId={Date($(vToday))}>} VAT_FREE_TOTAL_AMOUNT_NET)

Any idea?

Thanks,

MT

jfkinspari
Contributor III

Re: What is wrong with my set analysis

You might need to include single plings, as the date is a string

Sum( {$<DateId={'$(=Date(vToday,'DD/MM/YYYY'))'}>} VAT_FREE_TOTAL_AMOUNT_NET)

MVP
MVP

Re: What is wrong with my set analysis

Formatting vToday with Date() will only work if vToday has a numeric representation.

What's the definition and current value of your variable? Have you checked that you have a match of that value with your possible DateId values?

Re: What is wrong with my set analysis

Sorry, this may be a dumb question, but your date field is DateId or is it something else?

mttconseil
New Contributor

Re: What is wrong with my set analysis

Hello,

Thank you everyone ! It is working fine with Jens Frederik Kristiansen's formula.

==> Sum( {$<DateId={'$(=Date(vToday,'DD/MM/YYYY'))'}>} VAT_FREE_TOTAL_AMOUNT_NET)

Community Browser