Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
TomBond77
Specialist
Specialist

Last value of a dimension

Hi experts

We need the last value of a dimension "Category", this one is on the last snapshot "YM", Year Month.

Any ideas how to realize it?

TomBond77_0-1708078962694.png

 

24 Replies
TomBond77
Specialist
Specialist
Author

not yet working:

sum(
{<[YearMonth]
={"$(='>=' & Monthstart(Addmonths(Max(YearMonth),-11)) & '<=' & MonthEnd(Max(YearMonth)))"},
[Event Reason]={"$(Chr(39) & =firstsortedvalue ([Event Reason], -[YearMonth], 1) & Chr(39))"}>}
Joiner)

TomBond77_0-1708094991940.png

 

Anil_Babu_Samineni

@TomBond77 When you say not working, What is done the debugging? What we should do this case.

- Add another column with below expression and are you getting any data?

sum(
{<[YearMonth]
={"$(='>=' & Monthstart(Addmonths(Max(YearMonth),-11)) & '<=' & MonthEnd(Max(YearMonth)))"}>}
Joiner)

- Try to add this alone and check? what is the output for that?

$(Chr(39) & =firstsortedvalue ([Event Reason], -[YearMonth], 1) & Chr(39))

- Then use the same expression in Label and show us the result for validation.

sum(
{<[YearMonth]
={"$(='>=' & Monthstart(Addmonths(Max(YearMonth),-11)) & '<=' & MonthEnd(Max(YearMonth)))"},
[Event Reason]={"$(Chr(39) & =firstsortedvalue ([Event Reason], -[YearMonth], 1) & Chr(39))"}>}
Joiner)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
TomBond77
Specialist
Specialist
Author

Thanks

This is the result. This expression at the right column seems not to work.

TomBond77_0-1708105705924.png

 

Anil_Babu_Samineni

@TomBond77 Can i know what is not working here? If you can see the condition how the value produced and it is same for last column, Or, did i miss anything in between?

Anil_Babu_Samineni_0-1708115780996.png

 

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
TomBond77
Specialist
Specialist
Author

Thanks all

I think I need to resolve this issue in the loading script.

The following script is not working. The field "Event Reason_new" is never filled up:

if(date(Timestamp, 'YYYY-MMM')= date(Addmonths(MonthEnd(Today()),-1), 'YYYY-MMM'), [Event Reason]) as [Event Reason_new]

TomBond77_0-1708327919391.png

 

Why is the new field [Event Reason_new] is not filled up?

Thanks for your help!