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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
psenthilbtech
Contributor III
Contributor III

Count Days

Hi Team,

I have 2 Measures,

1. Sum(Actual)

2. Sum(Plan)

I have the records from 1st Jan 2018 till Date

The requirement is , i have to count the no of distinct days where my  sum(Actual) < sum(Plan).

Can anyone help me on this

2 Replies
andrey_krylov
Specialist
Specialist

Hi, If there is a date field in the model try this

Sum(if(Aggr(sum(Actual) - sum(Plan), DateField) < 0, 1, 0))

maddysalunke
Contributor II
Contributor II

Hi Senthil,

If you want to calculate for all days , then you can use =Date2-Date1

And if you want to calculate working day, then use =Networkdays (StartDate, EndDate {, Holiday})

You can write the expression as ,

if (sum(Actual) < sum(Plan),Networkdays (StartDate, EndDate {, Holiday}))


or

if (sum(Actual) < sum(Plan),Date2-Date1)


The Networkdays () returns the number of working days (Monday-Friday) between and including StartDate and EndDate taking into account any optionally listed holidays. All parameters should be valid dates or timestamps.


Thanks,

Madhura