Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
xtrimf
Creator
Creator

TimePeriods as Dimetions

Hi,

my customer requires a report that in one column shows the sales from January till current month-1,

in the second column - the sales for the current month.

Class() is not working properly in this case...

I also managed to create a calculation that does "January-May" & "Jun" (as two columns, for example), but the numbers are wrong...

Any suggestions?

Tnx

1 Solution

Accepted Solutions
prieper
Master II
Master II

Hi,

it should be possible to solve it also by SET-functions, but am not that firm. You may determine your timespan by some variable, which then should be hidden somewhere is your application.

See the attached example

HTH
Peter

View solution in original post

8 Replies
Not applicable

What does your data look like?

If you have months as a dimension in your data, you could do something like:

Exp 1: Sum({<Month = {'>=1<$(=Month(Today()))'}>} Sales)
Exp 2: Sum({<Month = {'$(=Month(Today())'}>} Sales)


If you have sales data and only have the sale date, I would suggest adding month in the load script. You could do something similar to the above using straight dates, but it's a bit more complicated.

xtrimf
Creator
Creator
Author

hi,

I can't use expressions because I'm already using them as dimentions to populate the table.

I need a calculated dimention.

And Yes, I am using "Month".

xtrimf
Creator
Creator
Author

?

xtrimf
Creator
Creator
Author

attached is an illustration of what i'm trying to achieve

Not applicable

Calculated dimensions can be a little tricky. You can't seem to use Aggreagation functions inside, trying to calculate your date span in the calculated dimension is out.

I did a Resident Load on the data and pulled out the min and max of the span. Then I built a calculated dimension to either be the current month or anything else, which then displays the span. The calculated dimension is messy, due to trying to pull out the month names using the number. Essentially, it is:

if(Month = Month(Today()), Month, SpanName)


I've attached a sample app that contains the resident load and the calculated dimension, along with a pivot table resembling your example.

xtrimf
Creator
Creator
Author

Its all good...but the dimention should be dynamic and not static....

prieper
Master II
Master II

Hi,

it should be possible to solve it also by SET-functions, but am not that firm. You may determine your timespan by some variable, which then should be hidden somewhere is your application.

See the attached example

HTH
Peter

xtrimf
Creator
Creator
Author

Tnx 🙂

Works great...i did something similar but your is more accurate 🙂

tnx again