Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

rita_tubal
New Contributor III

edit expression to get percentage

Hi everyone,

I am needing again your help on my project. 

I need to get the percentage of CRITERIA per week and I am having trouble creating formula.

can someone help me what part of my formula needed modification.

Count(lot_id)/Count(TOTAL(lot_id))

see attached for the RAW file.

1 Solution

Accepted Solutions
kaanerisen
Contributor III

Re: edit expression to get percentage

Hi Rita,

I am not sure that if you are trying to sum "plan_hours" and get a percentege over a week by Criteria. If that so, your expression on pivot table should be like this:

Sum(plan_hours)/sum(total <Fiscal_Week> plan_hours)

5 Replies
aarkay29
Valued Contributor

Re: edit expression to get percentage

Can you give a example with numbers from your excel please!

kaanerisen
Contributor III

Re: edit expression to get percentage

Hi,

Script:

test:

CrossTable(hours, value, 1)

LOAD

    Fiscal_Week,

    "[(1)<6 HRS]",

    "[(2)6-12 HRS]",

    "[(3)12-24 HRS]",

    "[(4)>24 HRS]"

FROM [lib://downloads/PERCENT PER CRITERIA.xlsx]

(ooxml, embedded labels, header is 1 lines, table is Sheet2);

Expression:

Sum(value)/sum(total <Fiscal_Week> value)

Result:

percent.png

rita_tubal
New Contributor III

Re: edit expression to get percentage

Hi Kaan,

I have attached a new RAW file.

where below are not a field but a result from the expression.

     [(1)<6 HRS],

     [(2)6-12 HRS],

     [(3)12-24 HRS],

     [(4)>24 HRS],

     [TOTAL LOTID]

how do I edit my formula or script using the attached data.

thanks

kaanerisen
Contributor III

Re: edit expression to get percentage

Hi Rita,

I am not sure that if you are trying to sum "plan_hours" and get a percentege over a week by Criteria. If that so, your expression on pivot table should be like this:

Sum(plan_hours)/sum(total <Fiscal_Week> plan_hours)

rita_tubal
New Contributor III

Re: edit expression to get percentage

Hi Kaan,

I have made some modification with your expression, instead of plan hours I change it to Lot_id and the result is what I am looking for.

Count(LotID)/Count(total <Fiscal_Week> LotID)

thank you!

Community Browser