Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
taha_mansoor
Creator
Creator

applying logic based on the dimension values in the table

Hi, 

I have a scenario whereby I need to put a logical condition in  a measure expression based on the dimension values in the same table chart. For example, I have below data set in my data model:

YearMonthValue
201311000
201322000
201413000
201424000

 

I have to achieve a KPI in the straight/pivot chart whereby I need to apply a logic on first year rows(i.e. rows having year 2013). So, what I want to do in the expression is something like: if year=2013, Value/Month-1. So, the evaluation of this should be 1000/0, 2000/1. Here I am substracting 1 from each value of the column Month refering the Year column value 2013 only. How  exactly I can write this in a straight/pivot chart expression having the dimensions Year and Month in chart as dimensions.

 

Thanks.

Qlik Sense Desktop 

3 Replies
Anil_Babu_Samineni

Perhaps this

Sum(Value)/(Max(Month)-1)

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
taha_mansoor
Creator
Creator
Author

@Anil_Babu_Samineni thanks for the response but I need to get the logic on Min Year, so even I replace the Max with Min and Month with Year in your expression above, it will take the Year value based on app selections. What if Year has not been selected. I need to apply the logic irrespective of selections i.e. based on dimension value of each row of the straight/pivot table. 

Anil_Babu_Samineni

You mean this?

Sum({<Year={$(=Min({1}Year))}>} Value)/(Max({<Year={$(=Min({1}Year))}Month)-1)

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