# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Contributor

## 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
Contributor III

## Re: Num and Date and string Format in qliksense

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'),

)))

Contributor

## Re: Num and Date and string Format in qliksense

Thru num format we can't acheive this?

Valued Contributor II

Hi Manoranjan,

Thanks

Arvind Patil

Contributor

## Re: Num and Date and string Format in qliksense

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?

Contributor III

## Re: Num and Date and string Format in qliksense

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

Contributor III

## Re: Num and Date and string Format in qliksense

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'),

)))

Honored Contributor III

## Re: Num and Date and string Format in qliksense

Hi,

try this

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

Contributor III