Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
madnanansari
Creator
Creator

Set Analysis

I have the below function which calculate the number of days till yesterday for the selections made in the filter for Year and month.

If there are no selections; it gives the number of days till yesterday during this month. For example today is 19th of october then this function will give 18. (the first line).

Where there is a selection; let say year 2017; it will give the number of days during the year till yesterday. and viceversa. (second line).

We have upgraded our system from 3.1 to september 2017 (b/c of some bugs to cover). Now the below function is giving '0' for all selections. please help to rectify.

If(getselectedcount([Year])<1 and getselectedcount([Month Year])<1,

Count({$<[Date] = {"<=$(=Today()-1)"},[Year]=,[Month Year]=,[MonthID]= {"$(=((Year(Today()) -1)*12) + Num(Month(Today())))"}>} [Date])

,

Count({$<[Date] = {"<=$(=Today()-1)"}>} [Date])

)

13 Replies
madnanansari
Creator
Creator
Author

it works for lot of things....that's why i dont like to change the formula....i just need correction in the formula

madnanansari
Creator
Creator
Author

this is the actual formula:

If(getselectedcount([Year])<1 and getselectedcount([Half Year])<1 and getselectedcount([Year Quarter])<1 and getselectedcount([Month Year])<1 and getselectedcount([Hijri Year])<1 and getselectedcount([Hijri Month Year])<1,

Count({$<[Date] = {"<=$(=Today()-1)"},[Hijri Year]=,[Hijri Month Year]=,[Year]=,[Half Year]=,[Year Quarter]=,[YearMonth No]=,[Month No]=,[Month Year]=,[Month]=,[MonthID]= {"$(=((Year(Today()) -1)*12) + Num(Month(Today())))"}>} [Date]),

Count({$<[Date] = {"<=$(=Today()-1)"}>} [Date])

)

pradosh_thakur
Master II
Master II

try this once

If(getselectedcount([Year])<1 and getselectedcount([Half Year])<1 and getselectedcount([Year Quarter])<1 and getselectedcount([Month Year])<1 and getselectedcount([Hijri Year])<1 and getselectedcount([Hijri Month Year])<1,

Count({$<[Date] = {"<=$(=Today()-1)"},[Hijri Year]=,[Hijri Month Year]=,[Year]=,[Half Year]=,[Year Quarter]=,[YearMonth No]=,[Month No]=,[Month Year]=,[Month]=,[MonthID]= {"$(=((Year(Today()) -1)*12) + Num(Month(Today())))"}>} [Date]),

count({1<Date={">= $(=min([Date])) <= $(=today()-1)"}>}[Date[))

)

you can replace the first expression of if condition simply as day(today())-1 or something similar to this.

Learning never stops.
madnanansari
Creator
Creator
Author

it dont work