Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
MrMadders
Contributor
Contributor

Formatting interval with comma separtors

Hi there,

 

I have an expression which returns a very large number of hours and minutes e.g.

8124282:42

I want to format this like

8,124,282:42

Is there a way to achieve this with the interval format?

 

 

Labels (1)
2 Replies
yogiachilleos
Contributor III
Contributor III

Howdy MrMadders,

You could try num(fieldName, ‘#,##0:00’) but not sure if that works. Alternatively you could script a solution as follows:
Load part1 & part2 as newFieldName;
Load
Num(Subfield(fieldName, ‘:’, 1), ‘#,##0’ as part1,
‘:’ & subfield(fieldName, ‘:’, 2) as part2
Resident tableName;

Kind regards,
Yogi Achilleos
rwunderlich
MVP
MVP

The interval format does not seem to accept a  thousands sep. The workaround I can think of is to format as interval, reinterpret as number, and add the commas.  I added a replace to get ':' before the minutes. 

=replace(num(num#(interval(now(2) - MakeDate(2000,1,1), 'h.m')),'#,##0.00'),'.',':')

// returns 170,153:13

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com