RE: Comparing chart between months
Hi Archetype,
Through the Instruction from the link, the most import is that you can create two custom field to store year and month of date field, then use them to create chart.
1.Create year and month field, then add then to the form and view you need.
2.Add filter to the view if you just show records that last year and current year.
you can use createdon date to set filter, i just test with custom date field.
3.Create chart.
4.Test.
Note: you can use js code fill year and month field automatically.
(1)js code.
function SetMonth(executionContext) {
var formContext = executionContext.getFormContext();
var date = formContext.getAttribute("new_date").getValue();
var d = new Date(date);
locale = "en-us";
var curr_year = d.getFullYear().toString();
var curr_month = d.toLocaleString(locale, { month: "long" });
formContext.getAttribute("new_month").setValue(curr_month);
formContext.getAttribute("new_year").setValue(curr_year);
}
(2)Add js code to the OnSave event.
Go to Settings > Customizations > Customize the system > Web Resource.
Go to Settings > Customizations > Customize the system > Entities >one entity you need> Forms > main form to click ‘Form Porperties’ button to open one dialog.
Regards,
Leah Ju
Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.