Embedding PowerView Dashboards within Dynamics AX Forms

PowerView is a great tool for creating dashboards and analytics for Dynamics AX, and you can easily embed it into Role Centers to create summary dashboards, and you can use it to drill into offending statistics that you notice, and you can easily create new dashboards using the new Analyze button in Dynamics AX 2012 R2. But what would be even better would be having context sensitive dashboards built into the actual master data forms. Then you would be able to see statistics and trends against the data that you a focused on. Fortunately that is not very hard to do.

In this worked example we will show how you can easily create a new dashboard through PowerView and then embed it within the Dynamics AX forms to show you just the statistics that you are looking for.

Creating a Customer Summary Dashboard

The first step in the process is to create a new PowerView Dashboard that you will embed into your master forms. Once you have done this, you can continue to tweak the view later on and not have to do any further coding.

How to do it…

To build a simple customer analysis dashboard, follow these steps:

  1. Start off by finding your PowerView Data Sources, and creating a new reporting canvas. In this example we will us the Sales cube as our data source.
  2. Build your dashboard from the available dimensions and measures in the cube. Here we just summarized the sales by date period, and also listed out all of the products that the customers have bought.

    Note: Don’t put any filters on this form. We will apply filters in the code later on.

  3. Once you have finished building the dashboard, select the Save As option from the File menu. When the Save As dialog box shows up, give your new dashboard a name and then click the Save button.

How it works…

Now if you return to the PowerView reports library you will see the new report that you just created.

If you open it then you will see your report in view mode.

Embedding the Dashboard into the Customer Form

Once you have designed your dashboard, it is time to add it to your forms. This will allow you to browse through the records, and see statistics alongside the original field data in Dynamics AX.

Getting Ready

In this example we will extend out the CustTable form, which normally looks like this.

How to do it…

To add the PowerView dashboard to a form in Dynamics AX, follow these steps:

  1. To do this, open up the AOT, and create a new project for the change. Then copy the CustTable form over to the new project.
  2. Expand the form definition until you are able to access all of UpperGroup set of controls which houses the definition for the main form layout.
  3. Right-mouse click on the UpperGroup form and from the New Control sub menu, select the Group item. Rename the group, and then set the Width to 600, and the Height to 512. We do this so that you can see the dashboard when it is displayed on the form โ€“ the default sizing for the control is a little narrow.
  4. Then right-mouse-click on the new group that you added and select the ActiveX option from the New Control sub menu. When the ActiveX browser is displayed, find the Microsoft Web Browser control and add it to the group.
  5. Give your new ActiveX control a more appropriate name, and also set the Width to Column Width, and the Height to Column Height so that it fills the container.
  6. Now open up the Methods at the parent table level, and right-mouse-click on the Methods group. Open up the Override method sub-menu and select the activate method. When the method editor opens up, add the following lines of code.
    Note: In the second line of the url variable definition, note the name of the report. This needs to match the name of the report that you created in the prior section.

    If you save the project and then open up the customer form, you will see the PowerView dashboard is now shown.
  7. Unfortunately this allows the user to edit the form. To fix that, update the code to include a couple more qualifiers.

    Now when you open up the form, you will just see the report.
  8. The final step in the process it to add some filters to the code so that it will only show the data that you selected.

    Here is the complete code listing:

How it works…

Now when the dashboard is displayed, it will only show the information that relates to the current record.

How cool is that!

Summary

This was just a quick example of how you could create a PowerView report and then embed it into the Dynamics AX forms.

This is not the only place that you could do this though. If you wanted, you could create dashboards for:

  • Inventory statistics and embed it within the products forms
  • Vendor scorecards, and include them in the vendor records to help with negotiations
  • Project status reports to help the project managers.
  • Employee performance

This is a simple change to make, so give it a go.

Advertisements
9 comments
  1. Martin Aldewereld said:

    Very interesting, thanks for te information

  2. aldewereld said:

    Murray, this is very interesting, thanks for the information

  3. Do you know if this will work with Office 365?

    • It should – all this is doing is embedding a web page in AX, and it could be sourced from anywhere ๐Ÿ™‚

      • Karel Moijson said:

        Dear Murray, I’m puzzled by your answer ๐Ÿ™‚ Such a web page could be sourced from anywhere, but Power View (or a classic Excel component) won’t work in Office 365 since the source is a cube in your example. A classic UDM cube resides on premise. In my opinion this can’t work with the current versions released?

      • Karel, sorry, you are right – I was just talking about anything that is hosted in Office 365 could be embedded. Unless you create an Azure datasource linked back to the ERP, then you probably won’t be able to do this… Murray.

  4. I have created a view for Item wise sales and i am embedding it on the Retail store form so that when i open the store page i can see the item sales of that store. i am getting an error message while saving the parent table method code. it is saying that “Variable PowerView has not been declared”.

    Can you please guide me on it.

  5. Mark said:

    Murray,

    Is there a way to force the ActiveX control / PowerView to update/refresh when the Next record navigator is selected? So as you navigate the different customers, it automatically updates the filter? It shows the correct customer filter when I first open the customer details form, but once I change the customer, it keeps the data from the initial customer in the PowerView

Leave a Reply to aldewereld Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: