Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
jtrillori
Partner - Contributor
Partner - Contributor

load expression

Mornig

I have a trouble withe a load script, maybe you can help me.

i have a invoice table, each invoice has a multiple departments and i want identify the department with the higher particaption on the invoice

INVOICEDEPARTMENTVALUE
INVOICE1DEPARTMENT11000
INVOICE2DEPARTMENT1500
INVOICE1DEPARTMENT2800
INVOICE1DEPARTMENT2400
INVOICE1DEPARTMENT3

12

INVOICE2DEPARTMENT3800
INVOICE3DEPARTMENT3200
INVOICE4DEPARTMENT112
INVOICE3DEPARTMENT1400
INVOICE4DEPARTMENT3500

the result must be.

INVOICE1 = DEPARTMENT2 (800+400)

INVOICE2=  DEPARTMENT3 (800)

INVOICE3 = DEPARTMENT1 (400)

INVOICE4 = DEPARTMENT3 (500)

Can you help me??

thanks and regards

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

Hi,

Please find attached file for solution.

Regards,

jagan.

View solution in original post

3 Replies
jagan
Luminary Alumni
Luminary Alumni

Hi,

Please find attached file for solution.

Regards,

jagan.

Not applicable

hi

try this

T:

LOAD INVOICE,

     DEPARTMENT,

     VALUE

FROM

(ooxml, embedded labels, table is Sheet1);

LOAD INVOICE,

    MAX(MAXVALUE) AS MAX,

    FirstSortedValue(DEPARTMENT,-MAXVALUE) as DEPARTMENT1

    Group by INVOICE;

T2:

LOAD INVOICE,

     DEPARTMENT ,

     SUM(VALUE) AS MAXVALUE

     Resident T

     Group BY DEPARTMENT ,INVOICE;


DROP Table T;

then output like this

INVOICEDEPARTMENT1MAX
INVOICE1DEPARTMENT21200
INVOICE2DEPARTMENT3800
INVOICE3DEPARTMENT1400
INVOICE4DEPARTMENT3500

jtrillori
Partner - Contributor
Partner - Contributor
Author

working nice with the two options.

thanks