Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Leverage your QlikView investment to modernize BI – see how! Join Group
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator
Creator

Avoid repeatation in formula

Dear team

Below I have mentioned a formula where I am dividing one formula with another formula. There is one condition is MonthNMum-='01'. Can we change the formula where I will use MonthNum only one time

=(Sum({<[Exec P&L Heading] = {'Gross Profit'},MonthNum={'01'} ,Year ={$(=max(Year))}>}Amount)*-1)

/

(Sum({<[Exec P&L Heading] = {'Revenue'},MonthNum={'01'} ,Year ={$(=max(Year))}>}Amount)*-1)

I need formula something similar to mentioned below.

MonthNum='01" then (Sum({<[Exec P&L Heading] = {'Gross Profit'},Year ={$(=max(Year))}>}Amount)*-1)

/

(Sum({<[Exec P&L Heading] = {'Revenue'},Year ={$(=max(Year))}>}Amount)*-1)

BR

SHamsu

 

1 Reply
Highlighted
Partner
Partner

Re: Avoid repeatation in formula

You could explore the use of calling the formel as a function using a parameter, where the parameter is the MonthNumber. That way you only need to set the MonthNumber once when calling the function.