Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Nested if then esle statement

Hi,

I have two if statements as shown below. The first works out the revenue target value for the current month to date if the day is not the first of the month and the seconds works out the values for the previous month (the dimension is customer. My problem is that I don't know how to put this in one statement as it errors. Maybe I'm not doing the best way and help would be greatly appreciated

=if (day(today())>1,
sum({$<MonthID = {$(=Max(MonthID))},
Quarter = ,
[LinkId] = {"TMP"},
Month ={
$(=month(today()))},
Year ={
$(=year(today()))}
>}
[Revenue Target Value]))
---------------
=if
(day(today())=1,
sum({$<MonthID = {
$(=Max(MonthID))},
Quarter = ,
[LinkId] = {"TMP"},
Month ={
$(=month(Addmonths(Today(), -1)))},
Year ={
$(=year(today()))}

>}
[Revenue Target Value]

1 Solution

Accepted Solutions
sunny_talwar

Right, so this isn't working? (Removed the parenthesis after the end of first Sum function)

=If(Day(Today()) > 1,
Sum({$<MonthID = {$(=Max(MonthID))}, Quarter = , [LinkId] = {"TMP"}, Month ={$(=month(today()))}, Year ={$(=year(today()))}>} [Revenue Target Value]),

Sum({$<MonthID = {$(=Max(MonthID))}, Quarter = , [LinkId] = {"TMP"}, Month ={$(=month(Addmonths(Today(), -1)))}, Year ={$(=year(today()))}>} [Revenue Target Value]))

View solution in original post

7 Replies
sunny_talwar

May be like this:

=If(Day(Today()) > 1,
Sum({$<MonthID = {$(=Max(MonthID))}, Quarter = , [LinkId] = {"TMP"}, Month ={$(=month(today()))}, Year ={$(=year(today()))}>} [Revenue Target Value])),

Sum({$<MonthID = {$(=Max(MonthID))}, Quarter = , [LinkId] = {"TMP"}, Month ={$(=month(Addmonths(Today(), -1)))}, Year ={$(=year(today()))}>} [Revenue Target Value]))

Not applicable
Author

Wow, how quick did you reply!!!

You put an extra bracket on the end. I took that off and got garbage after expression:"'," error

after the first if statement none of the restricted are highlighted in the second expression

Any idea

sunny_talwar

Right, so this isn't working? (Removed the parenthesis after the end of first Sum function)

=If(Day(Today()) > 1,
Sum({$<MonthID = {$(=Max(MonthID))}, Quarter = , [LinkId] = {"TMP"}, Month ={$(=month(today()))}, Year ={$(=year(today()))}>} [Revenue Target Value]),

Sum({$<MonthID = {$(=Max(MonthID))}, Quarter = , [LinkId] = {"TMP"}, Month ={$(=month(Addmonths(Today(), -1)))}, Year ={$(=year(today()))}>} [Revenue Target Value]))

Not applicable
Author

perfect thanks so much. You're a diamond., are you on linkedin?

sunny_talwar

I sure am

Not applicable
Author

what's your last name

sunny_talwar

Its Talwar