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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to get the Date

Hi All,

I have the following table

YearMonth , Revenue, Category

2013-1-1, 100,A

2013-2-1,200,B

If I use one pivot table to show the data, use YearMonth and Category as Dimension, and Sum(Revenue) as the Metric in expression.

What I want it, I want to get the Current row's YearMonth in the Expression.

Take example, the first row is 2013-1-1 in Dimension, which function I can use to capture that the current YearMonth is 2013-1-1?

Thanks.

9 Replies
tresesco
MVP
MVP

You can directly write : =YearMonth   in the expression.

Not applicable
Author

But when I use this one, it does not work:

=Sum({<YearMonth={'=$(=Only(YearMonth))'}>} Revenue)    YearMonth is the dimension

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

You can use YearMonth directly.

Also it depends on what expression your using Aggr or Sum.

Can you explain little bit more about the purpose of it.

CELAMBARASAN
Partner - Champion
Partner - Champion

Why your going for this kind of expression?

Sum(Revenue) will give you the Revenue for the YearMonth value in the dimension.

Not applicable
Author

Because I want to re-write the YearMonth

Take an example:

If YearMonth =2013-3, I want to show the revenue 2013-2 and 2013-3, the latest 2 months revenue in  YearMonth 2013-3

CELAMBARASAN
Partner - Champion
Partner - Champion

You need something like this

Sum(Revenue)+Alt(Above(Sum(Revenue)),0)

Not applicable
Author

Can we use the Set Analysis to achieve it by change the YearMonth?

CELAMBARASAN
Partner - Champion
Partner - Champion

No.Set analysis will work based on dimension.

er_mohit
Master II
Master II

Try this

sum(if(YearMonth=Aggr(NODISTINCT only(YearMonth),Category),Revenue))