Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
prabhas277
Creator
Creator

with out set analysis

Hi experts,

I have 12 months data in db now i want data for 6 th month.  how to write the set expression and and how to write the same query by using IF condition

Thanks In advance...

6 Replies
tresesco
MVP
MVP

Whenever you ask a query here, try to create a sample qvw and share. This helps you get the solution faster, because without that there would be many assumptions and subsequent queries. I.e. - let the people know how your data look like and how exactly the output you are expecting to be. So, try to share a sample qvw.

prabhas277
Creator
Creator
Author

HI,

Sum ({<year = {$(=max (year))}>} [budget amount]) - this is expression for max year right? so now


i want  max year by using IF condition instead of set analysis

settu_periasamy
Master III
Master III

Then, you can try

If(year = Max(year), true statement, false statment)

tamilarasu
Champion
Champion

Hi,


Hope you have date field. You can try with max(date).


Sum({<Date={‘>=$(=Addmonths(Max(Date), -6))<=$(=Date(Max(Date)))’}>} [budget amount])

tresesco
MVP
MVP

In a text box, try like:  Sum ( If(year =$(=max (year)), [budget amount]) )

jagan
Luminary Alumni
Luminary Alumni

Hi,

Set analysis is the best option for this type of scenarios, it has better performance over using If().  Not sure why you are not using the Set Analysis.

IF you really want then use below expression using Aggr()

Sum ( Aggr(If(year =Max(TOTAL year), Sum([budget amount]), 0), year))


Hope this helps you.


Regards,

jagan.