Dynamics CRM Marketing list dynamic date condition - dynamics-crm

I need to build a marketing list with date condition like so:
Month("End Date") = "This month" + 4
Basically, find records with End Date in 4 month
For example, if I pull the list on 6/12/17 - I will get all records with end date in Oct: 10/1/17, 10/2/17, etc
The closest I found is "Next X Month" but it also includes records within 3 month.
As an alternative - I'm exploring a path of creating workflow to update the "query" value of the marketing list record. Unfortunately, it's not possible to add Query field to the default form... this is getting very complex for a simple requirement.
Any ideas would be appreciated!

In the marketing list manage members, use "Add using Advanced Find" option and add all records with "Next 4 Month". Then use "Remove using Advanced Find" option and remove all records with "Next 3 Months".

Basically we can have a batch job every night, which will calculate the desired date or month filter for each contact record. Then fetchxml query for dynamic Marketing list can target this field.
Similarly rollup field can also be tried in contact.

Related

Google sheet adding a layer on top of a vlookup to make it conditional on a yes/no and a date

I would like to put in a basic toggle into a Google sheet.
Here is my reference table, It gets imported from another Google document so it's updated all the time.
I also have another google sheet that goes back to this lookup reference. It fills in the data if the date is less than today's date and matches the Date and the Source columns as a key.
I'd like to add another part in the Google sheet that says Include Today and you can type in the word "Yes"
If you type in Yes, I would like the yellow section, that uses the lookup_ref reference table, to include today's date, and otherwise include only days before today. In the example here, today is October 14, so if we type in "Yes" into this field, we need to have a value other than 0 for V15.
Okay, so you want to optionally include today's values in the formula. So you can conditionally add 1 day to today based on the value of "Include Today".
For example, if you add "Include Today" Yes/No value at cell "Z1", then you need to add IF(Z1="yes",1,0). So your formula can be
=IFERROR(IF(O15 < today() + IF(Z1="yes",1,0), vlookup(A15,lookup_ref,4,false), 0),0)

Rank only for latest month

I've a calculated field "Total Revenue" which blends revenue from multiple data sources in Tableau.
Based on this field (aggregate field) on monthly basis, I would like to show only TOP 5 items with highest revenue as of latest month.
As shown in above table, items have to be filtered out (as they are TOP 5 in March) based on revenue data as of the latest month (March). How can this be achieved using RANK()? I'm not able to rank only for latest month as formulated below because it shows error as I cannot mix aggregate and non-aggregate functions.
IF DATETRUNC('month'),ReportDate)=//March 1st date given//
THEN RANK(Total Revenue)
END
My solution is a kind of workaround but seems to be working:
Create a calculated field with below formula:
IF DATEPART('month', {MAX([date])}) = DATEPART('month', [date])
and DATEPART('year', {MAX([date])}) = DATEPART('year', [date])
THEN
[revenue]
ELSE
0
END
The {MAX([date])} part on the code gets the maximum date in your data, it is fixed with { and } characters so that the value is not effected by the filters, date partitions etc. If you want the sorting month to be the one we are in then you should change that part with NOW()
Now we have a value containing only the sum of the latest month and we can sort our visual with this Measure.
You can drag your new measure (I called my measure: 'last month revenue') to the details and right click your item pill on the Rows, sort it by your new field.
And finally drag your item to the filters and go to Top tab, make filter your data according to sum of "last month revenue" measure.
Below screenshot shows the excel data and the final Tableau table:

Conditional rollup fields for report

I have a report requirement to calculate campaign revenue (sum of associated Opportunity's actual revenue) on the basis of 30 days old, 60 days old and 90 days old opportunity. We are working on Dynamics crm online 2015.
Something like the following:
Campaign 30Days-Opp-Rev 60Days-Opp-Rev 90Days-Opp-Rev
What I have done so far:
1- I have tried to create rollup fields on campaign, but they don't allow conditions to restrict summation of opp revenue on the basis of date.
2- I have tried calculated fields but they don't summing up of child fields.
3- I have tried FetchXML reports but it doesn't support subquery or UNION types in xml.
Any help is highly appreciated.
you can write c# plugin and execute your fetch query in your plugin

Calculate age in Dynamics CRM

So there are a couple of similar questions, but all are using javascript, which isn't ideal as it requires the record to be opened / saved.
So, how can you calculate age based off birthdate. There are 200,000 records this would need to be done on and it's using CRM 2015, so can involve calculated fields as well.
It's going to be reported on in the background, so we can't use Javascript.
Workflows are a possibility, but running them on 200,000 records daily isn't exactly elegant!
Any other suggestions?
I've come across this requirement a number of times.
I've solved it by writing a Scribe or SSIS job which runs nightly and updates the Contact.Age field.
In order to not update every Contact record with the calculated age (as most ages won't have changed), I've used one of the following:
For on-premise CRM (where I have SQL access to the database), I wrote a query to return:
contactid
contact age
contact DoB
calculated age (calculated column from DoB and getdate)
The Scribe or SSIS job would only update records where Contact.Age != CalculatedAge
For hosted CRM (where I don't have SQL access to the DB):
Add a field called 'Next birthday'
The Scribe/SSIS job would search for records where NextBirthday is null or prior to today. It would update the Age and NextBirthday field.
Both of these methods mean that if the nightly job doesn't run for whatever reason, then when it's next run it will catch up on any records that are now out of date.
http://blogs.msdn.com/b/crm/archive/2009/02/27/creating-a-birthday-contact-list.aspx has an example using a pre-plugin to populate the birth month, year, and day fields. This could be adapted to instead perform the calculation to populate an age field. That being said, this would only work for new records or records that are changed.
If you wanted to do this via workflow, you'd have to have a workflow assembly to perform the calculation to populate an age field. As an alternative that doesn't require any code, you could create an Advanced Find query for All birthdays in a certain time frame, i.e. "Birthday on or before 2/17/1975" (this should limit the amount of records returned and reduce it from the total of the 200,000). Include the birthday and a new Age field created in the columns shown. I simply created an age field as a text field with a size of 5 characters since I'm intending only to store the years old someone is in it. Export the contacts to Excel marking the options, "Static worksheet with records from all pages in the current view" and "Make this data available for re-importing by including required column headings". Make sure to include the Owner column in order to prevent reassigning all these records to yourself when reimporting the records.
Then in Excel, create a formula like the following in the Age column assuming the birthdate field is in Column L, "=DATEDIF($L2,NOW(),"y")", which will update the age field with how many years old someone is as of the current date. Note that you might have to perform this calculation on a separate column and copy in just the values in order to ensure that Excel does not change the data type for the Age column or you will not be able to import that data back into Microsoft CRM. Fill that formula down so all records are updated, and save the file. Then in Microsoft CRM, import these records by pointing to the updated XML file (Excel 2003 XML format). Here your only restrictions are going to be on the size of the import file (CRM Limits this to 8 MB per file) and will be restricted to 10,000 records for the export, so this is another reason to break up the records you are exporting for reimport.
If you do update these via a workflow, you can update more than 250 at a time using a solution like the one in the CRM 2013 Bulk Workflow tool for XRM Toolbox http://www.zero2ten.com/blog/crm-2013-bulk-workflow-tool-for-xrmtoolbox/ , which allows you to select a group of records using FetchXML as the criteria for the records to apply the workflow to, noting that this may take some time to process if you are running this at the same time for all 200,000 records.
Ideally, my preference would be to have a plugin or JavaScript, but can see with your requirements that you would need to have this run either daily or on a monthly basis (although I would not run it for all 200,000 since everyone's age does not change each day). Just choose the records that have birthdays in a particular month or on a particular date to run the workflows on or to export and reimport for since that's going to be much less intensive for server processing and will be able to complete much faster than having to update all 200,000 at a time.

SSRS how to show only month/year as a parameter using/customizing calendar control

I use SSRS 2005.I currently have two datetime parameters (for start and end dates) as parameters for my report. I get the default calendar controls to select the dates.
I want to show only month and year in the calendar control which can be selected by user. Is that possible?
I can create two text fields and let user enter month & year in each text field and i've two validate these two text fields. I dont want to do this because needs typing into the fields.
OR
I can create four dropdown lists for start month, start year and end month and end year with values but this involves clicking/scrolling a bit more. Dont want to do this either.
Can somebody suggest a solution?
Thank you
Bo
This cannot be done using the calendar control.
You can either use the calendar control ignoring the day or implement one of the other two solutions you mentioned.
In case of combobox, you can use select distinct month/year from your data to fill values.
To make this less annoying for your user's to run the report, default your month/year from/to values to these that usually the user selects to run the report.
Personally I would prefer textboxes with default values
eg. If user runs the report for current year from January to current month then the defaults would be
Month from: = 1
Month to: = Datepart("m", Now())
Year from, Year to: = Datepart("yyyy", Now())

Resources