Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
emilyrabbit
Creator
Creator

loading script- count(distinct) failed

Hi Buddy, I tried to have a distinct count grouping by 2 fields.

Write below script in the loading script.But I found the distinct didn't work.

TEMP3:
NoConcatenate
Load
[Order Created By Rep]&[Order Year Month] as key,
Count(DISTINCT ([Order Document Number])) as COUNTNUM
Resident FACT_ORDER_FLUID_CONNECTORS
Group BY [Order Created By Rep],[Order Year Month]

emilyrabbit_1-1761117477391.png

Thanks in advance.

Labels (2)
3 Replies
robert_mika
MVP
MVP

Add the Distinct after load or remove the bracket after DISTINCT(

hanna_choi
Partner - Creator II
Partner - Creator II

Hello @emilyrabbit 

Even if distinct is displayed in black, the result seems to work normally.
The image below is the result of making and processing sample data.

hanna_choi_0-1761119591793.png

 

[ Result]

hanna_choi_1-1761119627868.png

 

******** No Distinct 

hanna_choi_2-1761119697305.png

[ Result ]

hanna_choi_3-1761119735005.png

 

 

If you share the sample data of "FACT_ORDER_FLUID_CONNECTORS" table

we can think about the problem together.

 

 

 

 

marcus_sommer
MVP
MVP

Be aware that:

[Order Created By Rep]&[Order Year Month] as key,

isn't equally reflected by:

Group BY [Order Created By Rep],[Order Year Month]

and you may need to adjust it to:

Group BY [Order Created By Rep]&[Order Year Month]

Further the combined key has no included delimiter. Depending on the content of the fields there may occur some kind of overlapping.