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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikviewaf
Creator
Creator

Condition on caluclation

Hi Guys,

i have two date for each sales-row on my data set.

First date is MonthYearInvoice the second date is MonthYearService.

i would like to calculate the % as follow:

Sales (Where MonthYearInvoice>MonthYearService) / Sales (without any condition)

i did it as follow but the result is 0

if(MonthYearInvoice>MonthYearService,sum(Sales),0) / Sum(Sales)

Anyone has an idea how to fix this?

Thanks

3 Replies
vishsaggi
Champion III
Champion III

Are the two data field formats same or different? May be you can use set analysis like

= Sum({< MonthYearInvoice = {"> MonthYearService"} >} Sales)/Sum(Total Sales)

OR

= Sum({< MonthYearInvoice = {"= $(= '>'&MonthYearService)"} >} Sales)/Sum(Total Sales)

YoussefBelloum
Champion
Champion

Hi,

what is the format of your fields (MonthYearInvoice and MonthYearService) ?

pradosh_thakur
Master II
Master II

try this


= Sum({< MonthYearInvoice = {"=(num(MonthYearInvoice) > num(MonthYearService))"} >} Sales)/Sum(Total Sales)

Learning never stops.