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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
tinkerz1
Creator II
Creator II

Trying to understand Max date in dimension

I dont understand why my max() on date dimension is producing an error in the date dimension

The reason I am avoiding set analysis is the get selected count expression that I want to swap between 2 list box entries. 

Dimension:

max([Month-Year Item])

if(GetSelectedCount([Region])>0,[Region],[Location])

Expression:

if([Data group]='Item',count(distinct [ID]))

1 Solution

Accepted Solutions
settu_periasamy
Master III
Master III

Hi,

Try the set analysis, Like

Dimension :

[Month-Year]

=if(GetSelectedCount([Region])>0,[Region],[Location])

Expression:

if([Data Group]='Item',count({<[Month-Year]={"$(=Max([Month-Year]))"}>}distinct [ID]))

May be try without set Analysis

Dimension :

=Aggr(Max([Month-Year]),[Data Group])

=if(GetSelectedCount([Region])>0,[Region],[Location])

Expression:

if([Data Group]='Item',count(distinct [ID]))

View solution in original post

5 Replies
Anonymous
Not applicable

try this:

Dimension:

max([Month])   ///what is year item??

if(GetSelectedCount([Region])>0,[Region],[Location])

Expression:

if([Data group]='Item',count(distinct [ID]))

swuehl
MVP
MVP

You would need to use advanced aggregation (aggr() function ) in the dimension if you want to agreggate values.

Otherwise the scope for the aggregation is not clear.

I am not sure why you need to use the max() function to be able to use the second dimension. Could you upload a small sample QVW?

nagarjuna_kotha
Partner - Specialist II
Partner - Specialist II

Hi Neli,

I didn't understand what exactly you are looking for?

Explain lttle bit more and expected outut.

Regards,

Nagarjuna

tinkerz1
Creator II
Creator II
Author


I am uploading a file with a date for every record for that month, so I am trying to group on that date.

Month-Year     Date Group     Location     Region     ID

05-2015          Item                Europe      UK           1

05-2015          Item                Europe      UK           2

05-2015          Item                USA          NY          3

06-2015          Item                Europe      UK           4

06-2015          Item                Europe      UK           5

06-2015          Item                USA          NY           6

07-2015          Item                Europe      UK           7

07-2015          Item                Europe      UK           8

07-2015          Item                USA          NY           9

I am just after a count distinct ID for all Items in  07-2015 and Europe for the  Location and getselectedcount(Region) is 0

settu_periasamy
Master III
Master III

Hi,

Try the set analysis, Like

Dimension :

[Month-Year]

=if(GetSelectedCount([Region])>0,[Region],[Location])

Expression:

if([Data Group]='Item',count({<[Month-Year]={"$(=Max([Month-Year]))"}>}distinct [ID]))

May be try without set Analysis

Dimension :

=Aggr(Max([Month-Year]),[Data Group])

=if(GetSelectedCount([Region])>0,[Region],[Location])

Expression:

if([Data Group]='Item',count(distinct [ID]))