Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
bhavvibudagam
Creator II
Creator II

Date Function

Hi Experts,

Can anyone please help me on this.

I have a date field contains the dates from 1/1/2016 to 1/1/2017.

Requirement:

When the user selects date/Month before 31st December 2017 it should executes first expression like

Sum({<Group={'Entertainment'}>}[MAINID])

When the user selects date/Month after 31st December 2017 it should executes second expression like

Sum({<Group={'Food','Clothes'}>}[MAINID])

Please suggest the solution to implement dynamically with the dates selection.

Thanks in advance.

7 Replies
luismadriz
Specialist
Specialist

Hi,

Something like this maybe?

Sum({<$(=IF(Max(DateField)<=vDateLimit,[Group={'Entertainment'}],[Group={'Food','Clothes'}])>} [MAINID] )

Cheers,

Luis

Anil_Babu_Samineni

Perhaps this? I remind you just pay with date format


If(datefield <= '31/12/2017', Sum({<Group={'Entertainment'}>}[MAINID]), Sum({<Group={'Food','Clothes'}>}[MAINID]))

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
avinashelite

I would suggest you to create flag in the script and handle this


in the script level


if(datefield <= '31/12/2017',1,2) as Date_Flag


in the front end use this flag like this , this work for month , date selections also


if(concat(DISTINCT Date_Flag)=1,Sum({<Group={'Entertainment'}>}[MAINID]), Sum({<Group={'Food','Clothes'}>}[MAINID]))


bhavvibudagam
Creator II
Creator II
Author

Hi Anil,

Thanks for your reply.

Is their any way to define dynamically instead of 31/12/2017.

avinashelite

You could use a variable for the same and use input box to set the variable so that it would be dynamic

Anil_Babu_Samineni

Of course, why not like yearend(today()).. Of not, I would ask business?

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
luismadriz
Specialist
Specialist

Hi,

Just wondering to know how you went about this one,

Cheers,

Luis

PS. When applicable please mark the appropriate replies as Correct. This will help community members know which discussions have already been addressed and have a possible known solution. Please mark replies as Helpful if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads as Helpful if you feel additional info is useful to others