Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
siddharthsoam
Partner - Creator II
Partner - Creator II

Can we put condition in max function

Hi

I want to apply a condition in max function.

Max({<[Fiscal Year]='FY16'>}( mid(Quarters,2)))

Ideally it should give me 4, but its not returning any value.

75 Replies
shraddha_g
Partner - Master III
Partner - Master III

What are you trying to achieve here?

siddharthsoam
Partner - Creator II
Partner - Creator II
Author

I have created a variable using this expression, i.e.

max({<fiscal_year={"$(=Maxstring(fiscal_year))"}>}quarter) named Max_quarter.

Now I want to use this variable Max_Quarter inside CONCAT() function along with if condition i.e.

concat( distinct if(mid(Quarters,2)=1,$(maxQuarter)),',')


But not getting the result as required.

shraddha_g
Partner - Master III
Partner - Master III

You are using wrong variable name

it should be $(Max_quarter) in your expression.

But why you are using Concat() here.

It will return you 1 value only.

What should be your expected outpu?

siddharthsoam
Partner - Creator II
Partner - Creator II
Author

Sorry I typed the variable name wrong while replying you,

We want that whenever we select Quarter Q1 even if the multiple quarters are selected, then it should get replaced by Q4.

- In order to get Quarter value Q1 I m using if() condition i.e. if(mid(Quarters,2)=1

- For multiple Quarter Selections I m using CONCAT() function.

- In order to replace Q1 with Q4 I m using variable Max_Quarter. which makes my expression as

concat( distinct if(mid(Quarters,2)=1,$(Max_Quarter)),',')


Current Quarter                Previous Quarter

Q4                                      Q3

Q3                                      Q2

Q2                                      Q1

Q1                                      Q0

My Requirement is that this Q0 should be replaced by Q4 of the previous year i.e.

Current Quarter                  Previous Quarter

Q4                                      Q3

Q3                                      Q2

Q2                                      Q1

Q1                                      Q4

NOTE: Previous year logic has already been implemented in Max_Quarter variable.

Please suggest changes in already build expression i.e. in

concat( distinct if(mid(Quarters,2)=1,$(Max_Quarter)),',')


Regards

Siddharth


shraddha_g
Partner - Master III
Partner - Master III

I guess this requirement is already provided in one of the qvf I had attached.

PFA image which shows Current quarter and Previous Quarter

Do you want it to be calculated and stored in a field?

siddharthsoam
Partner - Creator II
Partner - Creator II
Author

Totally agree but is it possible to manipulate this expression in doing so

concat( distinct if(mid(Quarters,2)=1,$(Max_Quarter)),',')


Yes I want to manipulate my sum expression according to this condition.

shraddha_g
Partner - Master III
Partner - Master III

I doubt.

But why do you want to use Concat().

When you can directly get previous Quarter from QuarterStart Date then you can use it in set analysis

shraddha_g
Partner - Master III
Partner - Master III

PFA

pooja821
Creator
Creator

Hi Shraddha can we merge both months and quarters logic in the same pivot and rename year as FY16 and FY17.

Thanks in advance  

shraddha_g
Partner - Master III
Partner - Master III

Yes it is possible