Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Count in script errors

Hi, hope someone can help me here, I'm getting an "Invalid expression" message with a line in my script and I can't see what's wrong.

For each area I want to count the number of times each distinct CODE_NUMBER is present when the STOCKSTATUS = SOLD

Thanks in advance

TMP_COUNT:
LOAD ID_NO,
count(CODE_NUMBER) as CODE_COUNT
Resident UNITS   where STOCKSTATUS = 'SOLD'   group by CODE_NUMBER, AREA;

1 Solution

Accepted Solutions
MindaugasBacius
Partner - Specialist III
Partner - Specialist III

You should use the Group by ID_NO.

QV Help example:

Grouping data

Load ArtNo, round(Sum(TransAmount),0.05) as ArtNoTotal from table.csv group by ArtNo;

Load Week, ArtNo, round(Avg(TransAmount),0.05) as WeekArtNoAverages from table.csv group by Week, ArtNo;

View solution in original post

7 Replies
MindaugasBacius
Partner - Specialist III
Partner - Specialist III

You should use the Group by ID_NO.

QV Help example:

Grouping data

Load ArtNo, round(Sum(TransAmount),0.05) as ArtNoTotal from table.csv group by ArtNo;

Load Week, ArtNo, round(Avg(TransAmount),0.05) as WeekArtNoAverages from table.csv group by Week, ArtNo;

jonathandienst
Partner - Champion III
Partner - Champion III

You need to include ID_NO in the Group By.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Digvijay_Singh

TMP_COUNT:
LOAD AREA,
count(CODE_NUMBER) as CODE_COUNT
Resident UNITS   where STOCKSTATUS = 'SOLD'   group by AREA;

Not applicable
Author

Hi, ID_NO is my transaction ID and I want to count across all transactions not Individual ones as there is only ver 1 code per transaction, therefore that will only ever bring me back a 1

Thanks

PrashantSangle

Hi,

then comment ID_NO from the table.

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 🙂
Not applicable
Author

Hi Simon

You don't need ID_No in your load statement


LOAD

               AREA,

               CODE_NUMBER,

              count(CODE_NUMBER) as CODE_COUNT
Resident

              UNITS 

where

              STOCKSTATUS = 'SOLD' 

group by

               AREA,

               CODE_NUMBER;

Not applicable
Author

Makes sense now, thank you guys