Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
kakaderanjit53
Creator III
Creator III

Custom Fuction Issue

Here My scenario is Create Custom Fuction to show values in Crores,Lacs,Thousands etc for that purpose

I Have Been Created One Variable in Script Level i.e

SET FormatNumber=Dual(

    if($1>=10000000,num($1/10000000,'₹ ##.##Cr'),

if($1>=100000,num($1/100000,'₹ ##.##L'),

if($1>=1000,num($1/1000,'₹ ##.##K'),

$1))) ,$1);

I Have Been Created One Variable in Frontend i.e  vCondition this variable contains expression like below

if(Measures='Logins',$(vTotalLogins),
if(Measures='Clients Traded (Unique)',$(vUniqueClientsTraded),
if(Measures='Volume (Cr)',$(vTotalVolume),
if(Measures='Brokerage in Lacs (Gross)',$(vBrokerage),
if(Measures='No. of Trading Days',$(vNoftradingdays),
if(Measures='Avg. brokerage per client',$(vAvgClientBrokerage),
if(Measures='Avg. daily login',$(vAvgDailyLogins),
if(Measures='Avg. daily brokerage',$(vAvgDailyBrokerage),
if(Measures='Avg. daily volume',$(vAvgDailyVolume)
)))))))))

here I am passing vCondition as a parameter to FormatNumber like below

$(FormatNumber($(vCondition)))

But I unable to get the expected result .

Hello Qlik Experts,

Please provide me the correct solution to overcome the above problem.

1 Reply
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Ranjit,

I'd suggest two improvements:

1. Start the formula in vCondition with the equal sign, in order to pick the relevant formula before the expression gets to the Chart Measure - that means that Measures cannot be your chart Dimension, but it will largely improve performance.

2. The parameter to the $-sign expansion needs to be enclosed in single quotes, to appear as a string:

$(FormatNumber('$(vCondition)'))

I believe that these two changes should fix the problem, however everything needs to be tested 🙂

We teach these advanced techniques at the Masters Summit for Qlik - check our upcoming schedule and see if our agenda is good for you.

Cheers,

Oleg Troyansky

Upgrade your Qlik Skills with my book QlikView Your Business: An Expert Guide to Business Discovery with QlikView and Qlik Sense