Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

joeybird
Contributor II

Calculations + conversion


Hiya

I have column called duration, its just a single numbers e.g 210

I have successfully converted this to minutes using

div([Duration], 60) & ':' & Mod([ Duration], 60)

and formatted the KPI to duration to show 3:30

all good if you want to do this for a single line of data

problem... I want to add up a number of columns

I have used this

sum([Duration]) + Div([Duration], 60) & ':' & Mod([Duration], 60)

to try and add up all the columns and the convert to minutes

it maybe a typo. I have tried different variant's and no joy

please help

Kind Regards

Joeybird

1 Solution

Accepted Solutions
stigchel
Honored Contributor

Re: Calculations + conversion

Columns? Or rows of data, then try

Div(Sum([Duration]), 60) & ':' & Mod(Sum([Duration]), 60)

4 Replies
stigchel
Honored Contributor

Re: Calculations + conversion

Columns? Or rows of data, then try

Div(Sum([Duration]), 60) & ':' & Mod(Sum([Duration]), 60)

joeybird
Contributor II

Re: Calculations + conversion

That's brilliant xxx

thank you.

Another question I would like to ask please is if

if I calculated one answer (answer one), then another (answer two) answer.

I wish to do a calculation answer one - answer two

how would I go about it please?

have tried

Div(Sum([Duration]), 60) & ':' & Mod(Sum([Duration]), 60) - Div(Sum([Duration_Finish_Time]), 60) & ':' & Mod(Sum([Duration_Finish_Time]),

Kind Regards

Joeybird

stigchel
Honored Contributor

Re: Calculations + conversion

Do the conversion after any calculation, the conversion results in a string with which you can't calculate.

Something like (if I did not make a typo)

Div((Sum([Duration]) - Sum([Duration_Finish_Time])),60) & ':' & Mod((Sum([Duration]) - Sum([Duration_Finish_Time])),60)

joeybird
Contributor II

Re: Calculations + conversion

Superb!!!

works wonderful

Kind Regards

Joeybird x