# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Contributor

## YTD to Single month data

Hi Experts,

I have two years of data in my app i.e, 2017 and 2018.

In the below chart each month sum(Sales) is the YTD amount from this YTD amount how to get individual month amount.

For example Dec month amount is amount from Dec - amount from Nov.

1 Solution

Accepted Solutions
MVP

## Re: YTD to Single month data

Try this for 2018

If(Sum({<Year={'\$(=Year(Max(Date)))'},Month>}Sales) <> 0,

RangeSum(Sum({<Year={'\$(=Year(Max(Date)))'},Month>}Sales)/1000000, -Above(Sum({<Year={'\$(=Year(Max(Date)))'},Month>}Sales)/1000000)))

2017

RangeSum(Sum({<Year={'\$(=Year(Max(Date))-1)'},Month>}Sales)/1000000, -Above(Sum({<Year={'\$(=Year(Max(Date))-1)'},Month>}Sales)/1000000))

7 Replies
MVP

## Re: YTD to Single month data

May be this

Sum(Sales) - Above(Sum({<Month>}Sales))

Contributor

## Re: YTD to Single month data

Hi Sunny,

Please find the below YTD Values Bar chart from 2017 and 2018.

I have used the below expression

2018= Sum({<Year={'\$(=Year(Max(Date)))'}>}Sales)/1000000

2017= Sum({<Year={'\$(=Year(Max(Date))-1)'}>}Sales)/1000000

As per the requirement I need to convert the above YTD values to monthly values For example Dec month amount is amount from Dec - amount from Nov.

I have tried like as you mentioned above like this.

2018= Sum({<Year={'\$(=Year(Max(Date)))'},Month>}Sales)/1000000 - Above(Sum({<Year={'\$(=Year(Max(Date)))'},Month>}Sales)/1000000)

2017= Sum({<Year={'\$(=Year(Max(Date))-1)'},Month>}Sales)/1000000-Above(Sum({<Year={'\$(=Year(Max(Date))-1)'},Month>}Sales)/1000000)

but getting results like below. In 2018 I have the data up to Jun but getting Jul bar also and for Jan I am not getting that month value from YTD. Please help me on this.

MVP

## Re: YTD to Single month data

May be do this for 2018

If(Sum({<Year={'\$(=Year(Max(Date)))'},Month>}Sales) <> 0,

Sum({<Year={'\$(=Year(Max(Date)))'},Month>}Sales)/1000000 - Above(Sum({<Year={'\$(=Year(Max(Date)))'},Month>}Sales)/1000000))

Contributor

## Re: YTD to Single month data

Hi Sunny,

But still I am not able to see jan month bars data.

For 2018 and 2017 jan month need to get actual values i.e., 12.19 and 9.74.

By above() the jan month showing no values.

Contributor

## Re: YTD to Single month data

Hi stalwar1,

I have tried this expression for 2017

=If(Rowno()=1,

Sum({<Year={'\$(=Year(Max(Date))-1)'},Month>}Sales)/1000000,

Sum({<Year={'\$(=Year(Max(Date))-1)'},Month>}Sales)/1000000-Above(Sum({<Year={'\$(=Year(Max(Date))-1)'},Month>}Sales)/1000000)

)

now I got 2017 jan bar

=If(Rowno()=1,

Sum({<Year={'\$(=Year(Max(Date)))'},Month>}Sales)/1000000,

If(Sum({<Year={'\$(=Year(Max(Date)))'},Month>}Sales) <> 0,

Sum({<Year={'\$(=Year(Max(Date)))'},Month>}Sales)/1000000 - Above(Sum({<Year={'\$(=Year(Max(Date)))'},Month>}Sales)/1000000))

MVP

## Re: YTD to Single month data

Try this for 2018

If(Sum({<Year={'\$(=Year(Max(Date)))'},Month>}Sales) <> 0,

RangeSum(Sum({<Year={'\$(=Year(Max(Date)))'},Month>}Sales)/1000000, -Above(Sum({<Year={'\$(=Year(Max(Date)))'},Month>}Sales)/1000000)))

2017

RangeSum(Sum({<Year={'\$(=Year(Max(Date))-1)'},Month>}Sales)/1000000, -Above(Sum({<Year={'\$(=Year(Max(Date))-1)'},Month>}Sales)/1000000))

Contributor

## Re: YTD to Single month data

Thanks a lot for your help