Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Display Sale by Month in Straight table

Hi all,

I have a calendar like below.

Daterange1.PNG.png

using this date range I would like to create Month wise sale in STRAIGHT table

I have Variable called

vFromDate & vToDate

and Field name called DECDDT1 and [Net Sales]

I can mange to find Jan & March Sales using below expression.

sum({<DECDDT1 = {'>=$(vFromDate) <=$(=Monthend(vFromDate))'}>}[Net Sales])  //---- For Jan Sale

sum({<DECDDT1 = {'>=$(=monthstart(vToDate)) <=$(vToDate)'}>}[Net Sales])  ///--For March Sales

How do I get FEB sale? or if I Increase/decrease Date range?

Thanks

Vinay




 

Labels (1)
6 Replies
its_anandrjs
Champion III
Champion III

Try like this

sum({<DECDDT1 = {'>=$(vFromDate) <=$(vToDate)'}>}[Net Sales])  //---- For Jan Feb Mar Sale

Hope this helps


Not applicable
Author

Hi Anand,

I want all months individually.

I Don't want Total of all Months which your expression gives me.

Vinay


its_anandrjs
Champion III
Champion III

In dimension use Month Dimension field and in expression use

sum({<DECDDT1 = {'>=$(vFromDate) <=$(vToDate)'}>}[Net Sales])  //---- For Jan Feb Mar Sale

Or

if if you have not month field extract like  Month(DECDDT1)


Hope this helps

Not applicable
Author

Hi Anand,

Thanks for reply,

But I want something like below in straight table.

                                                                                           

BranchJan 2014 SalesFeb 2014 SalesMarch 2014 Sales
1819,04519,11021,742
2011,17512,14113,103
2121,32321,11722,603
3518,73621,25123,167
4713,24112,30412,421
5916,41215,76717,740
6012,67012,57414,094
6117,59215,48518,394
8917,44318,46718,675
9010,63211,00511,448
11211,78612,85814,353
11417,09316,46217,852
11711,30411,11912,900
1597,4947,2157,719
Not applicable
Author

I am not sure why you would want to have this as a straight table as that would mean that you would have to hard code every month (compared to having a pivot table) with a YearMonth-dimension as a column header.

Your Start and End Months can then be calculated as:

Month 0:

$(vFromDate)

MonthEnd($(vFromDate)),0)

Month 1:

MonthStart($(vFromDate),1)

MonthEnd($(vFromDate)),1)

Month 2:

MonthStart($(vFromDate),2)

MonthEnd($(vFromDate)),2)

Month 3:

MonthStart($(vFromDate),2)

$(vToDate)


You should probably. Combine this with something like:


IF(MonthEnd($(vFromDate)),3)>$(vToDate),MonthEnd($(vFromDate)),2),0)


But to be honest this starts looking really ugly and hard coded.

I would definitely go for a PivotTable with the YearMonth-dimension on top.

Kind regards

Niklas

maxgro
MVP
MVP

you can use AddMonths on MonthStart / MonthEnd to express other months

Floor(Addmonths(MonthEnd($(vFromDate)),1))

Pay attention to MonthEnd, from help

MonthEnd(date [, shift = 0])

Returns a value corresponding to a timestamp with the last millisecond of the last date of the month containing date.

But as other people already suggested you're making a pivot with a lot of effort.......