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: 
manoranjan_d
Specialist
Specialist

Num and Date and string Format in qliksense

Hi all,

in the straight table i have given the expression as below

=if(Metrics='Amount', sum({<[Primary Comparison Date]={'$(vMin)'}>}Amount),

if(Metrics='Description',only({<[Primary Comparison Date]={'$(vMin)'}>}Description),

if(Metrics='Modify Date',Date(only({<[Primary Comparison Date]={'$(vMin)'}>}[Modify date]),'MM/DD/YYYY'),

)))


i want to display the amount in the num format where if the amount has negative value it have show in the brackests (), how to achive this in the if loop

8 Replies
d_prashanthredd
Creator III
Creator III

Try,

=if(Metrics='Amount',

     if(sum({<[Primary Comparison Date]={'$(vMin)'}>}Amount)<0,

          '(' & sum({<[Primary Comparison Date]={'$(vMin)'}>}Amount & ')',

          sum({<[Primary Comparison Date]={'$(vMin)'}>}Amount

     ),

if(Metrics='Description',only({<[Primary Comparison Date]={'$(vMin)'}>}Description),

if(Metrics='Modify Date',Date(only({<[Primary Comparison Date]={'$(vMin)'}>}[Modify date]),'MM/DD/YYYY'),

)))

manoranjan_d
Specialist
Specialist
Author

Thru num format we can't acheive this?

arvind_patil
Partner - Specialist III
Partner - Specialist III

Hi Manoranjan,

Please Find attachment it may help you:

Thanks

Arvind Patil

manoranjan_d
Specialist
Specialist
Author

i given this but this is not working in qliksense the reason is number format is in auto, due to this i can't achive this

suppose if i give money as num format #.##; (#.##) , now i m getting the result for negative in brackets,  but for the date format is giving like number format

how to achieve this in qliksense?

d_prashanthredd
Creator III
Creator III

Through num format we cant add characters as per my knowledge. Num format is there to achieve format flexibility.

d_prashanthredd
Creator III
Creator III

Ok got it.. Just the -ve amount you need to display in ( ) and there is no need of negative symbol.. ryt?

try below,

=if(Metrics='Amount',

     if(sum({<[Primary Comparison Date]={'$(vMin)'}>}Amount)<0,

          '(' & fabs(sum({<[Primary Comparison Date]={'$(vMin)'}>}Amount)&  ')',

          sum({<[Primary Comparison Date]={'$(vMin)'}>}Amount

     ),

if(Metrics='Description',only({<[Primary Comparison Date]={'$(vMin)'}>}Description),

if(Metrics='Modify Date',Date(only({<[Primary Comparison Date]={'$(vMin)'}>}[Modify date]),'MM/DD/YYYY'),

)))

antoniotiman
Master III
Master III

Hi,

try this

Num(sum({<[Primary Comparison Date]={'$(vMin)'}>}Amount),'$#,##0.00;($#,##0.00)')

d_prashanthredd
Creator III
Creator III

I got to know about this.. Thanks