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

Calculate percent in line chart - calculated dimension

Hi there,

I need to create a line chart that shows proportional percentages across the chart (i.e. the % should add up to 100)

The calculated dimension is:

=If([Duration]>Time('0:30:00','h:mm:ss'),

  IF([Type]='Type1',Hour([Start Time])))

Expression (returns incorrect value):

count([PrimaryKey]) / count(TOTAL [PrimaryKey])

I tried using set analysis but only suceeded partly. The condition for [Type] works but not for [Duration]:

count([PrimaryKey]) / count(TOTAL {<Type={'Type1'}, [Duration]={">Time('0:15:00','h:mm:ss')"}>} [PrimaryKey])

Appreciate your responses, thanks!

6 Replies
its_anandrjs

Try it like

count([PrimaryKey])

/

count(TOTAL {<Type={'Type1'}, [Duration]={">$(=Time('0:15:00','h:mm:ss') )" }>} [PrimaryKey])

Regards

Anand

its_anandrjs

And another one is

count([PrimaryKey])

/

count(TOTAL {<Type={'Type1'}, [Duration]={'>$(=Time('0:15:00','h:mm:ss') )'}>} [PrimaryKey])

Regards

Anand

Anonymous
Not applicable
Author

hi,

Please refer to below post:

http://community.qlik.com/message/156954#156954

Regards

Neetha

Not applicable
Author

Hi Anand,

Thanks for your responses. I tried both methods and even assigned =Time('0:15:00','h:mm:ss') to a variable (hoping that might help). Unfortunately none of the options work. "No data to display" is the message shown on the chart.

Not applicable
Author

Hi Neetha,

I'm using the TOTAL keyword but it doesn't work in my case because I have a calculated dimension. It looks like the person in the link you provided isn't using a calculated dimension.

Maybe I'm missing something?

Thanks.

Anonymous
Not applicable
Author

Hi Aviral,

Please try by creating new expression in expression tab:

count([PrimaryKey])/count(TOTAL {<Type={'Type1'}, [Duration]={'>$(=Time('0:15:00','h:mm:ss') )'}>} [PrimaryKey])

Check relative button (or) Number Tab -  Select fixed option and check show in percent option.

Regards

Neetha