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

Set analysis

Can anyone help to convert the below expression to set analysis?

and MTD for the selected  month r date??

=sum(if(month(today(0))=month(Date),sales))

3 Replies
sunny_talwar

Within the script

LOAD Date,

          MonthName(Date) as MonthYear

Resident.....

Try this for sum of sales for the current month.

=Sum({<MonthYear = {"$(=MonthName(Today(0)))"}>} Sales)

Are you also looking to calculate MTD(Month to date)?

Best,

Sunny

ToniKautto
Employee
Employee

Why do you want to convert it to a set expression?

I do not think your expression is perfect for a set expression. You should add a field in your data model that returns the Month(Date) value. If we assume this field has been added and if called 'MonthDate' a set expression could look something like...

=sum( {<MonthDate={"$(=month(today(0)))"}>} sales )

Anonymous
Not applicable
Author

Try this:

=sum({<Date={"=MonthStart(today(0))=MonthStart(Date)"} sales))