Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
kunkumnaveen
Specialist
Specialist

How to get max date

Hello All,

Capture.PNG

In  a line chart I have two Dimensions:

                                                                  1)Fiscal Year

                                                                  2)PROD_HIER4_Name

I need to write expression where it has to pick  MAX--VALIDFROM date's ---->Average PRICE_MAT at PROD_HIER4_Name level

in the above case  it has to be       (2208.27+1722.9)/2 irrespective of BMATERIAL

I Tired the below expression but I am not getting any output...

aggr(avg({<VALIDFROM={'$(=max(PRICE_MAT))'}>}PRICE_MAT),PROD_HIER4_Name)


what am I missing in above expression


Thanks

1 Solution

Accepted Solutions
sunny_talwar

May be this

Avg({<[FISCAL YEAR]>} Aggr(If(Only({<[FISCAL YEAR]>} VALIDFROM) = Max({<[FISCAL YEAR]>} TOTAL <[FISCAL YEAR], PROD_HIER4_Name> VALIDFROM), Avg({<[FISCAL YEAR]>} PRICE_MAT)),[FISCAL YEAR],VALIDFROM,PROD_HIER4_Name))

View solution in original post

15 Replies
shraddha_g
Partner - Master III
Partner - Master III

VALIDFROM ={"$(=max(VALIDFROM))"}

kunkumnaveen
Specialist
Specialist
Author

Hi, Could u say what am I missing in second chart

Capture.PNG

Chart1) avg({<[FISCAL YEAR]=>}PRICE_MAT)

Chart 2)  avg({<VALIDFROM ={"$(=max(VALIDFROM))"},[FISCAL YEAR]= >}PRICE_MAT)

In second chart I am getting only selected fiscal year ,even though I disable the fiscal year selection

what am I missing?

shraddha_g
Partner - Master III
Partner - Master III

It will only give you data for max validfrom date.

What is the max(VALIDFROM) returnig?

sunny_talwar

Because your ValidFrom is a date and it might only show up in the most recent year...

shraddha_g
Partner - Master III
Partner - Master III

What is the dimension you have used in chart?

kunkumnaveen
Specialist
Specialist
Author

Capture.PNG

For Each fiscal year I need to show Max Valid form's Average price

kunkumnaveen
Specialist
Specialist
Author

Dimension:

                                                                  1)Fiscal Year

                                                                  2)PROD_HIER4_Name

sunny_talwar

Then may be try this

Avg({<[FISCAL YEAR]>} Aggr(If(Only({<[FISCAL YEAR]>} VALIDFROM) = Max({<[FISCAL YEAR]>} TOTAL <[FISCAL YEAR]> VALIDFROM), Only({<[FISCAL YEAR]>} PRICE_MAT)), [FISCAL YEAR], VALIDFROM))

kunkumnaveen
Specialist
Specialist
Author

Capture.PNG

I Am not getting any value for the above expression...

Can u help me , what should I need to do in the below expression to display all the FY data irrespective   of selection

avg({<VALIDFROM ={"$(=max(VALIDFROM))"},[FISCAL YEAR]= >}PRICE_MAT)