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

Best practice for filtering on a calculated expression

I have Dimension Style, Date, Sale$, Cost$. I am making a table with

  • Style,
  • Sum(Sales$ set analysis based on date),
  • Sum(Cost$ set analysis based on date.),
  • GM%( Calculation based on previous two columns).

I would like to filter out everything that has less than 35% GM%. What is the best way to do that in the app without heading into the Data load or even the SQL script. 

EDIT: Here is the actual GM% expression which returns a decimal:

 (1 -
(SUM({<[DateNum]={">=$(=$(vToday)-7)"}>}[Net Sales Cost])
/
SUM({<[DateNum]={">=$(=$(vToday)-7)"}>}[Net Sales Rtl])))

1 Solution

Accepted Solutions
gmenoutis
Partner - Creator II
Partner - Creator II

I guess the easiest way would be to modify sum(sales),sum(cost) and gm to return 0 if gm<35%, and use "hide zeroes" on the object properties.

Else, you would have to make GM a calculated dimension and use "include nulls", which is a bit of a headache. 

View solution in original post

5 Replies
Anil_Babu_Samineni

Perhaps this way?

If(Num(<GM% Formula>, '#,#0%')>=Num(35/100, '#0%'), <GM% Formula>)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
danelooman
Creator
Creator
Author

So this just nulls out that particular value in that particular column if it is less than 35% however I want the entire row to be removed.

gmenoutis
Partner - Creator II
Partner - Creator II

I guess the easiest way would be to modify sum(sales),sum(cost) and gm to return 0 if gm<35%, and use "hide zeroes" on the object properties.

Else, you would have to make GM a calculated dimension and use "include nulls", which is a bit of a headache. 

danelooman
Creator
Creator
Author

That is what I ended up doing. It isn't ideal because irl I have like 10 expressions so that is killing my performance but it isn't bad. 

gmenoutis
Partner - Creator II
Partner - Creator II

If you have many expressions maybe it's better to make a calculated dimension instead. That way you don't have to do future expression alterations, too.