Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Distinct Count

Hi,

Can you please help me with the syntax for distinct count.

This is the field structure

Order_NumberDDADDQOTIF
1100
1111
1111
2111
2111
2111
3111
3111

I want count of Order number when OTIF=1;

In the above case Count should be 2.

I am trying the syntax

XYZ=count({<OTIF=1>[DISTINCT]}Order_Number) and I am getting an error.

Please not DDA, DDQ and OTIF all are calculated fields.

TIA

Arjun

3 Replies
datanibbler
Champion
Champion

Hi,

that actually looks good. You could replace it with an IF_construction and see if that works.

I don't know how your LOAD looks - just keep in mind that, if you want to base one calculation on another done in the same LOAD, you cannot use the alias_name, but you have to repeat the calculation - or you do a preceding LOAD (put another LOAD statement, just without the FROM-part, above the main one - then you can use the alias_names of fields.

HTH

PrashantSangle

Hi,

There are some mistake in your set analysis

try below

=count({<OTIF={'1'}>} DISTINCT Order_Number)

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
PrashantSangle

Hi,

Well I did not read that OTIF is calculated field

Is it in Script or in chart, if it is in chart

then

try

count(if(OTIF_Expression=1,Distinct Order_Number))

If it is in script then you get OTIF as field in Front end

then above set analysis in my previous post will work for you.

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂