Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
dseelam
Creator II
Creator II

Calculate Percentage in load script

Hello All,

How to Calculate Percentage in load script, We give allowance to customers on top of gross sales, I have $ amounts given on CSV for allowance how to calculate allowance% from it, in load script itself?

Attached Sample

Thanks,

D

1 Solution

Accepted Solutions
ahaahaaha
Partner - Master
Partner - Master

Hi,

If I understood you correctly, maybe like this?

LOAD

    ITEM_NUMBER,

    GROSS_SALES,

    fabs( ALLOWANCES) as ALLOWANCES,

(ALLOWANCES/GROSS_SALES)*100 as Percentage

FROM

(txt, utf8, embedded labels, delimiter is ',', msq);

View solution in original post

2 Replies
ahaahaaha
Partner - Master
Partner - Master

Hi,

If I understood you correctly, maybe like this?

LOAD

    ITEM_NUMBER,

    GROSS_SALES,

    fabs( ALLOWANCES) as ALLOWANCES,

(ALLOWANCES/GROSS_SALES)*100 as Percentage

FROM

(txt, utf8, embedded labels, delimiter is ',', msq);

sunny_talwar

May be this?

fabs(ALLOWANCES)/GROSS_SALES as [ALLOWANCE %]