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: 
Not applicable

Use If statement in Set Analysis

Hi,

I want set fiscal year depending fiscal actual month in set analysis expression but it doesn't work.

Here you are the expression i'm using:

=Sum({<Anio={"$(=If(Num(Month(Today()))=10, Max(Anio)-1, Max(Anio)))">} Amount)

Can Anyone help me?

10 Replies
swuehl
MVP
MVP

'Doesn't work' is not a good issue description, could you elaborate a bit more?

What does the dollar sign expansion return (e.g. if you use the expression in a text box)?

How do the field values of field Anio look like? Pure year numbers (integers)?

Not applicable
Author

Anio is iqual to: 2016, 2017, etc...

Not applicable
Author

I type the next expression and work correctly but I would like to learn apply if condition in set analysis

=if(Num(Month(Date(Today())))=10,

      Sum({<Anio={$(=Max(Anio)-1)}>} Amount),

      Sum(Amount)

    )

neelamsaroha157
Specialist II
Specialist II

Sum({$<Anio={"$(=If(Num(Month(Today()))=10,Max(Anio)-1,Max(Anio)))"}>}Amount)

I guess you are missing one of the parenthesis.

Anil_Babu_Samineni

This is the case, This one is good approach as per my experience. Because, You are displaying the values for Amount when condition is satisfy. or else second value. I am assuming this one is good one only. Let's wait for reply from Experts

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
Not applicable
Author

wow!

Yes, that right; i was missing one of the parenthesis.

Thanks very much Neelam.

Not applicable
Author

this expression only apply if you want to display the information y text objet but. really i'm using this expresion with simple condition, so I'm not using the second condition.

for example you can to have a pivot table displaying sales for actual month and last month but if the fiscal year is staring (depending of month) you have to go to past year.

My fiscal year start in Octuber; it means that this month one but my last month belongs to past year because the new fiscal year is staring again.

I hope you understand!

neelamsaroha157
Specialist II
Specialist II

Can you share sample data with expected output.

neelamsaroha157
Specialist II
Specialist II

I am not sure if you have Fiscal calendar built in your application, if not, then you may consider this.

Fiscal and Standard Calendar generation

Fiscal Year