Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
shakil4sk
Contributor
Contributor

Set Analysis Problem

I have created a Previous Year YTD measure

Sum({$<[Transactions.Account Type]={'Expense','Income','Cost of Goods Sold'},
[Transactions.Txn Date] = {">=$(=AddYears(YearStart(Max([Transactions.Txn Date])),-1))<=$(=AddYears(Max([Transactions.Txn Date]),-1))"}>}[Transactions.Amount With Sign])

 when i select year filter it shows 0 but when i select month it shows correct value.

i could not figure out the problem.

 

Please help

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar

What is the your year field called? Assuming it is called [Transactions.Txn Year], try this

 

Sum({$<[Transactions.Account Type]={'Expense','Income','Cost of Goods Sold'},
[Transactions.Txn Date] = {">=$(=AddYears(YearStart(Max([Transactions.Txn Date])),-1))<=$(=AddYears(Max([Transactions.Txn Date]),-1))"}
, [Transactions.Txn Year]>}[Transactions.Amount With Sign])

View solution in original post

3 Replies
sunny_talwar

What is the your year field called? Assuming it is called [Transactions.Txn Year], try this

 

Sum({$<[Transactions.Account Type]={'Expense','Income','Cost of Goods Sold'},
[Transactions.Txn Date] = {">=$(=AddYears(YearStart(Max([Transactions.Txn Date])),-1))<=$(=AddYears(Max([Transactions.Txn Date]),-1))"}
, [Transactions.Txn Year]>}[Transactions.Amount With Sign])
Vegar
MVP
MVP

Your year selection is affecting your expression. You need to cancel out year

Sum({$<
Year,
[Transactions.Account Type]={'Expense','Income','Cost of Goods Sold'},
[Transactions.Txn Date] = {">=$(=AddYears(YearStart(Max([Transactions.Txn Date])),-1))<=$(=AddYears(Max([Transactions.Txn Date]),-1))"}
>}[Transactions.Amount With Sign])
shakil4sk
Contributor
Contributor
Author

Nope, I don't have [Transactions.Txn Year] field but i got the point.

Ok thanks a lot