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

Not able to understand independent field concept

Hello everyone,

I have an issue with selection ,my issue is that when we make any expression independent of any field then why we it change when we select it  i am not able to understand its concept plz help ...eg suppose  want to calculate sum({<CalendarMonth={$(=Max(CalendarMonth))},CalendarYear>}sales),then when i am selection CalendarYear its value is changing so i want to understand the concept of selection,Plz help..

Thanks in advance

Ferha Jafri

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Hi Ferha,

If you don't include the "CalendarMonth=," part in the set then, the data gets filtered with the selection of the same field and evetually the max() function returns a variable result based on the selection. For example, if you select 'Jan' in CalendarMonth field, the CalendarDate field also gets filtered accordingly with the date of Jan only, and the Max(Calendardate) would return 31st Jan. If you put CalendarMonth=, in set then, the CalenderMonth field selection would get ignored and the scope of the Max(Calendardate) remains all the dates and return a date maximum available irrespective of the calendarMonth field selection.

View solution in original post

8 Replies
tresesco
MVP
MVP

Because, in your expression you mentioned Max(CalendarMonth), and it returns different results on different selections. If you want that this max function should return the max calendar month irrespective of the selection in CalendarYear field, you have to additionally put, CalendarYear=, in the set analysis, like:

sum({<CalendarMonth={$(=Max(CalendarMonth))},CalendarYear=>}sales)

CalendarYear=, simply tells to avoid the selection in that field.

Hope this gives you an idea.

vikasmahajan

SUM({$<Year={$(=max(Year))}>} [Sales Amount])

This will give sales for year max in your data.

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
Not applicable

In your set analysis, change CalendarYear to CalendarYear = and then try your CalendarYear selection again.

Anonymous
Not applicable

Hi tresco,

do as Shawan084 suggesting if you do not want the values affected by selection on year.

now the expression which you are using will   sum sales of sales of that month which is highest

in all months   ok let say you have

Year 2012    and  has sales value for  Calendarmonth   1  to 12  and Year 2013 and sales data for each  month

                    say till now september of which CalendarMonth is 9.

so according to your expression that you are trying to use

sum({<CalendarMonth={$(=Max(CalendarMonth))},CalendarYear=>}sales)

will do sum of Maximum  Month recorded  which is 12 of previos year and will do sum of sales for month no 12

of previous year and not september of this year.

also if Month no 12 that is Dec is present of previous year say 2011, 2010.... then your expression will sum

sales of each month no 12 ie Dec month of all years that is present in your tables.

please let me know if any thing is not clear.

Regards,

Anant

ferha_jafri
Partner - Creator III
Partner - Creator III
Author

Hi Tresesco,

Tell me why i am not able to get the result untill  i did not mention CalendorMonth= in the expression

The expressionis:

Sum({<CalendarDate={">=$(=date(maledate(year(max(calendardate))-1,'mm\dd\yyyy'))<=$(date(makedate((year(max(calendardate))-1),CalendarMonth="}>} NetSales)

the expression is not giving any value untill we didnot mention the expression independent of calendaryear any idea why it is happening..

tresesco
MVP
MVP

Hi Ferha,

If you don't include the "CalendarMonth=," part in the set then, the data gets filtered with the selection of the same field and evetually the max() function returns a variable result based on the selection. For example, if you select 'Jan' in CalendarMonth field, the CalendarDate field also gets filtered accordingly with the date of Jan only, and the Max(Calendardate) would return 31st Jan. If you put CalendarMonth=, in set then, the CalenderMonth field selection would get ignored and the scope of the Max(Calendardate) remains all the dates and return a date maximum available irrespective of the calendarMonth field selection.

ferha_jafri
Partner - Creator III
Partner - Creator III
Author

Hi Tresesco,

(if(GetSelectedCount(CalendarMonth)=0,

Sum({$<CalendarDate={">=$(=Date(YearStart(max(CalendarDate)),'MM\DD\YYYY'))<=$(=DATE(Makedate(Year(max(CalendarDate)),num(Month(Today())),Day(Today())),'MM\DD\YYYY'))"}>} NetSale),

Sum({$<CalendarDate={">=$(=Date(YearStart(max(CalendarDate)),'MM\DD\YYYY'))<=$(=DATE(Makedate(Year(max(CalendarDate)),num($(=Max(CalendarMonth))),Day(Today())),'MM\DD\YYYY'))"}>} NetSale))

)

-

(if(GetSelectedCount(CalendarMonth)=0,

Sum({$<CalendarDate={">=$(=DATE(Makedate(Year(max(CalendarDate))-1),'MM\DD\YYYY'))<=$(=DATE(Makedate((Year(max(CalendarDate))-1),num(Month(Today())),Day(Today())),'MM\DD\YYYY'))"},CalendarYear=>} NetSale),

Sum({<CalendarDate={">=$(=DATE(Makedate(Year(max(CalendarDate))-1),'MM\DD\YYYY')) <=$(=DATE(Makedate((Year(max(CalendarDate))-1),num(Max(CalendarMonth)),Day(Today())),'MM\DD\YYYY'))"},CalendarYear=>} NetSale))

In the above expression for the previous year i wan not getting values untill i didnot place a condition as CalendarYear=,so my issue is why i am getting values for 1st expression but not for second expression untill i did not place calendaryear=

ferha_jafri
Partner - Creator III
Partner - Creator III
Author

Thank you so much i understand the concept..