Qlik Community

Ask a Question

New to QlikView

If you’re new to QlikView, start with this Discussion Board and get up-to-speed quickly.

Announcements
Welcome to our newly redesigned Qlik Community! Read our blog to learn about all the new updates: READ BLOG and REPORTED ISSUES
cancel
Showing results for 
Search instead for 
Did you mean: 
Contributor II
Contributor II

Help in Set Analysis - Calculation conditions

Hi,

My requirement is to display Sum of SalesAmount for ProdA and ProdB , For ProdA it should calculate Sales Amount for Year is 2016 and Jan, Feb of 2017 and For ProdB it should display Sales Amount of Year 2018. I need to write single expression to display this measure.
Can some one help on this scenario. 

SnoProductIdSaleDateSaleAmount
1ProdA01-01-2016250
2ProdB01-05-2016600
3ProdB01-09-2016600
4ProdA01-10-2016260
5ProdA02-10-2016650
6ProdA03-10-2016400
7ProdA01-01-2017600
8ProdB01-02-2017600
9ProdA01-02-2017950
10ProdB09-09-2017500
11ProdA01-01-2018600
12ProdB02-01-2018600
13ProdB03-01-2018260
14ProdA04-01-2018260
15ProdB05-01-2018650
16ProdB06-01-2018500
17ProdB07-01-2018600
18ProdB08-01-2018250
19ProdA09-01-2018600
20ProdA10-01-2018300
Labels (1)
1 Solution

Accepted Solutions
Creator III
Creator III

Hi Sheker

 

You can use union (+) in set analysis like below

=Sum({<ProductId = {'ProdA'}, SaleDate = {">=01/01/2016<01/03/2017"}> + <ProductId = {'ProdB'},SaleDate = {">=01/01/2018<=31/12/2018"}>}SaleAmount)

and output will be like below

 

Capture.PNG

I hope this answers your question

 

Thanks

Kushal

View solution in original post

2 Replies
Partner
Partner

sum({<ProductId={'ProdA'},SaleDate={">=01-01-2016 <01-03-2017"}>}SalesAmount)+ sum({<ProductId={'ProdB'},SaleDate={">=01-01-2018 <01-01-2019"}>}SalesAmount)
keep in mind it is better to use nums for the dates. and also I use dd-mm-yyyy format
Creator III
Creator III

Hi Sheker

 

You can use union (+) in set analysis like below

=Sum({<ProductId = {'ProdA'}, SaleDate = {">=01/01/2016<01/03/2017"}> + <ProductId = {'ProdB'},SaleDate = {">=01/01/2018<=31/12/2018"}>}SaleAmount)

and output will be like below

 

Capture.PNG

I hope this answers your question

 

Thanks

Kushal

View solution in original post