# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

New Contributor III

## Comparing same number of months in a graph with the help of dimensions

Hi, I have a graph as follows that shows the market share for products in terms of sales by the fiscal years 2016-2018.

But since 2018 is only in the 8th Month, I want to be able to compare the previous two years only upto 8 months and add this as an alternative dimension. Can someone help me with the code on this one? I have data across months called 'Fiscalmonth' and across Quarters as well called 'Fiscal Quarter'

Thanks a ton

1 Solution

Accepted Solutions
Contributor

## Re: Comparing same number of months in a graph with the help of dimensions

Hi Mallika,

What I think you should do :

- Create a new field, if not existing, in your calendar that is the monthnum of the date

num(month(date)) as NumMonth

- In the set analysis of your new measure, include Sum({< NumMonth = {" <= \$(=num(month(Today())))"} >} >} [Sales])

Synthax must be inexact but I think that's the idea.

Hope it helps,

Regards,

Marina

Contributor

## Re: Comparing same number of months in a graph with the help of dimensions

Hi Mallika,

What I think you should do :

- Create a new field, if not existing, in your calendar that is the monthnum of the date

num(month(date)) as NumMonth

- In the set analysis of your new measure, include Sum({< NumMonth = {" <= \$(=num(month(Today())))"} >} >} [Sales])

Synthax must be inexact but I think that's the idea.

Hope it helps,

Regards,

Marina