Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Qlik_Enthu
Creator II
Creator II

Is it possible to add calculation expressions in Main content?

Hi All,

I Wanted to display summary of values in my mail body. How to achieve that?

Thank you,

Regards,

Sai

4 Replies
johanlindell
Partner - Creator II
Partner - Creator II

Hi,

Are you referring to the "Alert" email functionality? If so yes, just make an expression, same as you would on a text box like this:

'Sales this week ' & Num (Sum ({<Date = {">=$(=WeekStart (Today()))"}>} Sales), '# ##0', ',', ' ')

Qlik_Enthu
Creator II
Creator II
Author

Hi I have tried the above, but it is not working. The formula is not getting resolved into a value.

P.S. I have added 3 calculations in the mail content and First line of the mail is a notification sentence.

Regards,
Sai

johanlindell
Partner - Creator II
Partner - Creator II

Hi,

Have you tried to put the formula in to a Text box to see if it works? You have to start with an equal sign (or a dollar-expansion?):

='Sales this week ' & Num (Sum ({<Date = {">=$(=WeekStart (Today()))"}>} Sales), '# ##0', ',', ' ')


If the above does not work then there is something wrong. You could also put the message into a variable and use the variable.


SubjectSales:

LOAD Sum (Sales) as SalesThisWeek

Resident Invioces

Where Date >= WeekStart (Today ())

LET SubjectSales = 'Sales this week ' & Num (Peek ('SalesThisWeek', 0, 'SubjectSales'), '# ##0', ',', ' ');


DROP Table SubjectSales;


and then set the subject to =SubjectSales


I usually make a page with textboxes for recipients, conditions, subject and messages. Then I create variables for these and check that the formulas are working OK. And then use the formulas in the Alerts.


Example:

Variable: vL.AlertNetSalesSubject

Formula: 'Net Sales ' & Capitalize (Date (Today () - 1, 'MMMM')) & ' '& Year (Today () - 1) & ': ' & Num(Sum ({$<Year = {'$(=Year (Today () - 1))'}, Month = {'$(=Month (Today () - 1))'}, [Sales type] = {'Product sales'}>}  [Net amount company currency])/1000000, '0,0' & ' MSEK')

Textbox: =$(vL.AlertNetSalesSubject)

Alert Subject: =$(vL.AlertNetSalesSubject)

The above works. Checking that it works in a text box makes sure you get the '-characters right and the $-expansions correct.

Good luck!

Johan

Qlik_Enthu
Creator II
Creator II
Author

Hi The above formula I used is already implemented as a KPI.

Let me try again