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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Issue with expression

Hi,

Below is my expression:

=$(vLogFn($(=

sum({<[Report Date]={'>=$(vToDateMonthStart) <=$(vToDateMTD)'}>} [New Issuance Principal])

-

sum( {<[Report Date]={"$(=Date(Monthstart(Max({<Metric=,DateFlag={'2'}>}[Report Date]))))"},Metric={"Orig Loans/Advances ($M)"}>} [Forecast Value])*1000000*

num#(day(Max({<Metric=,DateFlag={'2'}>}[Report Date])))/num#(day(monthend(Max({<Metric=,DateFlag={'2'}>}[Report Date]))))

)))

This expression returns -2.28M

But I want to show it as (2.28M) when the result is negative.

So basically the requirement is to show the difference in brackets when its negative and to show it as is when its positive.

Can anyone please let me know what change I need to make in my expression to achieve the result.

I want to display the output in a text box.

Note: LogFn is defined as below

pick(floor(log10(fabs($1))/3)+1, num($1, '#,##0.'), num($1/1000, '###K'),num($1/1000000, '###M'),num($1/1000000000, '###B'))

Thank you in advance.

Regards,

Sachin

11 Replies
sunny_talwar

May be this:

Pick(Floor(log10(fabs($1))/3)+1, num($1, '#,##0.; (#,##0.)'), num($1/1000, '###K;(###K)'),num($1/1000000, '###M;(###M)'),num($1/1000000000, '###B;(###B)'))

Not applicable
Author

Super Kool, Sir. It just worked.
Appreciate all your help.

sunny_talwar

Glad it worked. and you can just call me Sunny my friend.

Not applicable
Author

Sunny,

But now my other expression

=$(vLogFn($(=sum( {<[Report Date]={"$(=Date(Monthstart(Max({<Metric=,DateFlag={'2'}>}[Report Date]))))"},Metric={"Orig Loans/Advances ($M)"}>} [Forecast Value])*1000000*

num#(day(Max({<Metric=,DateFlag={'2'}>}[Report Date])))/num#(day(monthend(Max({<Metric=,DateFlag={'2'}>}[Report Date]))))

)))

is returning 3.28)

Earlier it was returning 3.28M

There's a brace coming up after the number instead of the letter

sunny_talwar

What about K? is that working find?

Not applicable
Author

No

sunny_talwar

Not sure why it would work with one expression and not with another. Would you be able to show a sample?

Not applicable
Author

The dashboard is like 3 GB. Not sure how to share with you.

sunny_talwar

Screenshots may be with the expressions, output, variable (vLogFn)