# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

New Contributor III

## Filter data in Qlik Sense Table

Hi,

I have a simple query which you can answer.

I have a table

Date                           Customer_Name          Purchase_count

10-09-2017                John                              430

10-09-2017                Ryan                              400

10-09-2017                Martin                          200

11-09-2017                John                              450

11-09-2017                Ryan                              400

11-09-2017                Martin                          580

12-09-2017                John                              700

12-09-2017                Ryan                              300

12-09-2017                Martin                          210

I want to display 2 KPI values for 'Martin' for 2 different periods.

KPI 1:           Period 1 Purchase count for Martin(This Month)        :          Sum of all days Purchase_count for this month

KPI 2:           Period 2 Purchase count for Martin(Last Month)        :          Sum of all days Purchase_count for last month

Can any one please help me with the expression which I can use to filter this data.

Please never mind if this is an easy question. Thanks.

Tags (1)
1 Solution

Accepted Solutions
Honored Contributor II

## Re: Filter data in Qlik Sense Table

for current month:

sum( {< Customer_Name = {'Martin'}, Date = {">=\$(=MonthStart(Today()))<=\$(=MonthEnd(Today()))"} >} Purchase_count )

for last month:

sum( {< Customer_Name = {'Martin'}, Date = {">=\$(=MonthStart(AddMonths(Today(), -1)))<=\$(=MonthEnd(AddMonths(Today(), -1)))"} >} Purchase_count )

3 Replies
Valued Contributor

## Re: Filter data in Qlik Sense Table

Hello,

Regards,

Kavita

Honored Contributor II

## Re: Filter data in Qlik Sense Table

for current month:

sum( {< Customer_Name = {'Martin'}, Date = {">=\$(=MonthStart(Today()))<=\$(=MonthEnd(Today()))"} >} Purchase_count )

for last month:

sum( {< Customer_Name = {'Martin'}, Date = {">=\$(=MonthStart(AddMonths(Today(), -1)))<=\$(=MonthEnd(AddMonths(Today(), -1)))"} >} Purchase_count )

New Contributor III

## Re: Filter data in Qlik Sense Table

Thank you so much. It got some data. Let me check accuracy.