Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
ioannagr
Creator III
Creator III

I need advice on this set analysis (cytd-lytd)

Hi all. 🙂

I think i have an easy question for you today.

My cytd-lytd measure is this, kept simple for the sake of the question:

count({$<CurYTDFlag={1}, Year=, Month=, date= >} distinct [ids])
- count({$<LastYTDFlag={1}, Year=, Month=,date= >} distinct [ids]))

 

1)First of all i think this ignores selections in year, month and date, right?

2)The way it is now the user can check for example 2019 and it calculates a difference ( i assume vs 2018).

What should I do for it to stay static? Like, now that the current year is 2021, i want it to show only 2021 vs 2020 and the user NOT be able to see for other year comparisons. Or if they can, i want to ensure they see the right difference.

5 Replies
Lauri
Specialist
Specialist

1) You are right. (You don't need the "=" but it's ok to have them.)

2)  For current year, if "Year" is the right field: Year={"=$(=Year(Today()))"}

For last year: Year={"=$(=Year(Today())-1)"}

ioannagr
Creator III
Creator III
Author

Hello @Lauri , thank you.

As for the 1st bullet and your answer to me about it, how is this ignoring year selections the moment i can choose any years and it making calculations? I'm confused!

Lauri
Specialist
Specialist

Is it possible that you are selecting years using a different field or a calculated dimension? If you don't filter on the exact field named "Year" then the Set Analysis containing Year=, won't have an effect.

ioannagr
Creator III
Creator III
Author

It's the same field! I thought because I declared  in set analysis CurYTDFlag={1} that 2021 was assumed  (vs 2020)  and with also ignoring selections with Year=, that the selection in filter Year wouldn't have an effect, but it does 😕 @Lauri 

Lauri
Specialist
Specialist

If you upload your QVF I can look at it.