1

I am trying to get days from given data like this:

In this data suppose ID B start date is 4/10/2019 and end date is 10/25/2019. Here there is 7 months: April to October, so for the first month start date is 4/10/2019 and end date is 4/30/2019 so this means he only avail 10 days from this month and remaining days is 21.. same for here end date is 10/25/2019 so if we look calendar end date 10/31/2019 we only avail 6 days so in data I want to get above data which is mentioned in image .. where as I am trying this formula in qlikview:

=sum(
  If(
    MonthName(CalendarMonthEnd) = MonthName([End Date]),
    ([End Date]-CalendarMonthStart+1),
    (RangeMin([End Date],CalendarMonthEnd)-RangeMax([Start Date],CalendarMonthStart))
  )
)

and through this formula I get this data which is remaining days where i want to get days which is availed...

this is link of folder please download and check ..

https://www.dropbox.com/s/v48373io1bv9qqj/file_qlik.rar?dl=0

in this folder the excel file "output.. " in this excel file the first table output which i need

MIRROR
  • 61
  • 1
  • 2
  • 10

1 Answers1

0

Just add another if

=Sum(
    If(CalendarMonthStart >= [Start Date] and CalendarMonthEnd <= [End Date],
             CalendarMonthEnd-CalendarMonthStart,
        If([Start Date]>CalendarMonthStart,
            [Start Date]-CalendarMonthStart+1,
            CalendarMonthEnd-[End Date])
    )
 )
)

Hubert Dudek
  • 1,666
  • 1
  • 13
  • 21