Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

If statement/Set Anlysis - Show only current sales data

We have products that move through warehouses.   I want to only show products which have sales in the last 6 months.

If I just use the ProductNo as a dimension, I get all the products that have had sales in that warehouse.

I am trying to do a calculated dimension along these lines (tried both ways) to only show products with active sales.

=If(SUM({$<Date_InvoiceDate={">=$(=monthstart(date(today()-180)))"} >} Invoice_SalesAmount)>0, ProductNo)

=SUM({$<Date_InvoiceDate={">=$(=monthstart(date(today()-180)))"} >} if(Invoice_SalesAmount>0, ProductNo))

1 Solution

Accepted Solutions
sunny_talwar

May be this:

If(Aggr(Sum({$<Date_InvoiceDate={">=$(=MonthStart(Date(Today()-180)))"} >} Invoice_SalesAmount), ProductNo) > 0, ProductNo)

View solution in original post

5 Replies
sunny_talwar

May be this:

If(Aggr(Sum({$<Date_InvoiceDate={">=$(=MonthStart(Date(Today()-180)))"} >} Invoice_SalesAmount), ProductNo) > 0, ProductNo)

swuehl
MVP
MVP

If you want a calculated dimension:

=aggr(

If(SUM({$<Date_InvoiceDate={">=$(=monthstart(date(today()-180)))"} >} Invoice_SalesAmount)>0, ProductNo) ,      ProductNo

)

Or using ProductNo as dimension and a set expression to filter expressions:

=SUM({$< ProductNo = {"=Sum( {<Date_InvoiceDate={'>=$(=monthstart(date(today()-180)))'} >} Invoice_SalesAmount)>0"} >} Incoice_SalesAmount)

settu_periasamy
Master III
Master III

Hi,

did you try the same expression with suppress zero value in presentation tab

(Dimension : Product)

=SUM({$<Date_InvoiceDate={">=$(=monthstart(date(today()-180)))"} >} Invoice_SalesAmount)

Not applicable
Author

Yes - Sunny's example with the Suppress Null worked like a charm.

sunny_talwar

Awesome