Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

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

)))

manoranjan_d
Contributor

Re: Num and Date and string Format in qliksense

Thru num format we can't acheive this?

arvind_patil
Valued Contributor II

Re: Num and Date and string Format in qliksense

Hi Manoranjan,

Please Find attachment it may help you:

Thanks

Arvind Patil

manoranjan_d
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?

d_prashanthredd
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.

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

)))

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

d_prashanthredd
Contributor III

Re: Num and Date and string Format in qliksense

I got to know about this.. Thanks

Community Browser