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

Column in IF

Good day

It is necessary to calculate the number of days when the stock was higher than the average sales

Average Sales are in the first column

Count (Distinct if (stock> Column (1), Date)) does not work

5 Replies
whiteline
Master II
Master II

Hi.

Could you provide more info about chart dimensins and expression in Column (1) ?

Not applicable
Author

Dimensions: goods

Average Sales:

Sum({<Date={">=$(=

Date(If(

IsNull(

FirstSortedValue({<Count={">0"},Satus={"1"},Check={"1"}>}   Date, -Date, 20)),

Min({<Count={">0"},Ststus={"1"},Check={"1"}>}Date),

FirstSortedValue({<Count={">0"},Status={"1"},Check={"1"}>}  Date, -Date, 20))

))"},Count={">0"},Status={"1"},Check={"1"}>} Count

)

/If(

IsNull(

FirstSortedValue({<Count={">0"},Status={"1"},Check={"1"}>} Date, -Date, 20)),

Count({<Date={">=$(=Min({$<Count={">0"},Status={"1"},Check={"1"}>}Date))"},Count={">0"},Status={"1"},Check={"1"}>}distinct Date ),20)

whiteline
Master II
Master II

the number of days when the stock was higher than the average sales

You could use aggr() to check it for all Dates (and keep goods dimension):

=Count (aggr(if(stock>Column (1), Date, null()), Date, goods))

Not applicable
Author

does not work

whiteline
Master II
Master II

Could you post a sample ?