top of page
  • Writer's pictureAlan Campbell

Analyze Sales with Geospatial Dashboard in Power Apps

Updated: Oct 30, 2023

In today's rapidly evolving business landscape, data-driven decision-making is the cornerstone of success. As companies strive to gain a competitive edge and streamline their operations, harnessing the power of technology has become more crucial than ever. Microsoft Power Platform, with its cutting-edge tools and capabilities, offers a transformative solution for business users seeking to elevate their insights and efficiency.


One of the standout features within the Power Platform ecosystem is Power Apps Geospatial Controls, which provides an invaluable toolset for visualizing and analyzing geographic data. For organizations utilizing Microsoft Dynamics 365 Business Central, the potential applications of this technology are truly game-changing, particularly when it comes to understanding and optimizing customer sales levels.


Gone are the days of complex spreadsheets and static reports to comprehend sales patterns and customer behaviors. With Power Apps Geospatial Controls, businesses can dynamically map out customer sales levels on an interactive, intuitive interface. This geospatial visualization empowers users to unlock a new dimension of insights, allowing them to identify sales hotspots, distribution gaps, and emerging trends with a simple glance.


Imagine effortlessly zooming in on specific regions, cities, or even individual customer locations, all while obtaining real-time data on sales performance. These visual representations not only make it easier to spot opportunities for growth but also enable quicker and more informed decision-making. Whether you're a sales manager looking to allocate resources strategically, a marketing executive targeting specific demographics, or an operations director optimizing supply chains, the Power Apps Geospatial Controls bring data to life in a way that is both accessible and actionable.


Furthermore, the seamless integration with Microsoft Dynamics 365 Business Central ensures that the geospatial insights provided by Power Apps Canvas Apps are not isolated from the broader operational context. The synergy between these platforms allows for a holistic view of your business data, enabling you to align sales strategies with inventory management, resource allocation, and customer relationship management. This integration streamlines processes, reduces inefficiencies, and enhances collaboration across departments, ultimately resulting in a more agile and responsive organization.


In this blog we will create a simple customer geospatial dashboard using Microsoft Power Apps that shows customer locations and analyzes sales data from Microsoft Dynamics 365 Business Central. We will be using the Cronus company and the Business Central Standard APIs V2.0 connector with the customers and customerLedgerEntries tables. Please note that I modified the customer addresses to be actual addresses taken from maps.


The dashboard will show customer locations on a map. Each location will be painted with a color indicating the customer's all-time sales levels. Customers with $400k+ of sales will be shown in green, $300k+ of sales will be shown in blue, $100k+ of sales will be shown in grey, $75k+ of sales will be shown in yellow, and anything less than $75k of sales will be shown in red. The user will be able click on a customer in a customer list pane and see the customer's location. Or, the user can click on the customer's map location and the customer information will show. Let's get started.

Customer geospatial dashboard in Microsoft Powerapps using Power Apps Maps to show Microsoft Business Central Customer sales
Customer Geospatial Dashboard Show Business Central Customer Information

1. Go to your Power Apps Admin Center. Under the environment settings search for "Map and address services". Set the Full option to on. Make sure to save your settings.

You need to set the Map and address services to Full to enable the Power Apps Maps features
Power Apps Admin Setting for Map and Address Services

2. We need to create two collections that will be used by the galleries and Map control. We will create a customer ledger collection and a customer collection from the two tables we added to the app. The code will identify the sales level each customer has achieved over time and will add a color indicator to the collection. Add the following code to the App OnStart trigger off the app.

Insert code in the OnStart trigger of the Power App you are creating
Insert Code in the OnStart trigger on the App

ClearCollect(
    CustomerLedgerCollection,
    ForAll(
        Filter(
            'customerLedgerEntries (microsoft/reportsFinance/beta)',
            documentType = "Invoice"
        ),
        {
            customerNumber: customerNumber,
            invoiceNumber: documentNumber,
            description: description,
            postingDate: postingDate,
            amount: amount
        }
    )
);
ClearCollect(
    CustomerCollectionTemp,
    ForAll(
        'customers (v2.0)',
        {
            id: ThisRecord.Id,
            customerNumber: ThisRecord.'No.',
            name: 'Display Name',
            allCustomers: false,
            address: 'Address Line 1' & ", " & City & ", " & State & " " & 'ZIP Code',
            amount: Sum(
                Filter(
                    CustomerLedgerCollection,
                    customerNumber = 'No.'
                ),
                amount
            )
        }
    )
);
ClearCollect(
    CustomerCollection,
    {
        name: "All Customers",
        allCustomers: true
    },
    AddColumns(
        CustomerCollectionTemp,
        "color",
        If(
            amount > 400000,
            Color.Green,
            amount > 200000,
            Color.Blue,
            amount > 100000,
            Color.Gray,
            amount > 75000,
            Color.Yellow,
            amount > 0,
            Color.Red
        )
    )
);
Set(
    collectionReference,
    CustomerCollection
);

3. Add a gallery to the screen. Add the customerName field from the CustomerCollection to the gallery as a label. On the right arrow icon OnSelect trigger enter the following code. The code determines if the user wants to see all customers or one customer.

Create a Power Apps Gallery to show customer collection data
Add a Gallery showing the CustomerCollection Data

If(
    ThisItem.allCustomers = false,
    ClearCollect(
        ThisCustomer,
        Filter(
            CustomerCollection,
            id = ThisItem.id
        )
    );
    Set(
        collectionReference,
        ThisCustomer
    );
    Set(
        customerRecordSelected,
        LookUp(
            CustomerCollection,
            id = ThisItem.id
        )
    );
    ,
    Set(
        collectionReference,
        CustomerCollection
    );
    Set(
        customerRecordSelected,
        LookUp(
            CustomerCollection,
            id = GUID()
        )
    )
)  

4. Create a customer information pane to show customer information. On the labels showing data enter the appropriate field from the customerRecordSelect record. For instance, the text property for the customer number should be customerRecordSelected.customerNumber.

Create a Customer Information Pane in Power Apps to display customer information
Customer Information Pane

5. Along the bottom of the screen we will create a second gallery. Bind the Gallery to the CustomerLedgerCollection by entering in the galleries items property the following code. Add fields and headers to the Gallery as shown.

Create a power apps gallery to show Microsoft Business Central customer invoices
Customer Invoice Information

If(
    Gallery1.Selected.allCustomers = false,
    Filter(
        CustomerLedgerCollection,
        customerNumber = Gallery1.Selected.customerNumber
    ),
    CustomerLedgerCollection
)

6. For this exercise, we are going with a fairly plain vanilla look to the maps. Insert a Map control into the screen and set the following properties:

Insert a Map control within Power Apps to show customer locations
Power Apps Map

a. On the items property enter collectionReference.

b. On the InfoCards property set the property to None.

c. On the Onselect property enter the following code:


		Set(
    			customerRecordSelected,
    			LookUp(
        				CustomerCollection,
        				customerNumber = Map1.Selected.customerNumber
   			 )
		);		

7. Test the App.

a. Click on All Customers in the gallery. You should see a map with all the with different colored customer locations based upon their total sales.

b. Click on a customer on the map. The customer information should show in the customer information window and the customer's invoices will show in the lower pane.

b. Click on a customer in the gallery. The map should zoom to the region with the customer and the customer information should show along with the customer's invoices in the lower pane.


In conclusion, the synergy between Microsoft Power Platform, Power Apps geospatial controls, and Business Central is a game-changer for businesses seeking to maximize their sales insights. The ability to visualize sales data dynamically on interactive maps opens up a new realm of possibilities for strategic decision-making and market understanding.


Gone are the days of sifting through spreadsheets and static reports – now, with a few clicks, you can uncover hidden patterns, identify growth opportunities, and respond swiftly to market shifts. The real-time nature of these tools empowers businesses to stay agile and proactive, which is crucial in today's ever-evolving market landscape.


The beauty of this integration lies not only in its functionality but also in its accessibility. You don't need to be a data scientist or a tech expert to harness the power of geospatial controls and Power Platform. The user-friendly interface and intuitive design make it possible for professionals from all backgrounds to dive into data-driven insights headfirst.


As we move forward in this data-centric era, it's clear that the ability to visualize information in a meaningful and dynamic way will be a pivotal factor in staying competitive. Microsoft's suite of tools offers not just a solution but a transformational journey, guiding businesses towards smarter decisions and more impactful outcomes.


So, whether you're a small startup or a global enterprise, take a leap into the world of geospatial visualization and supercharge your sales strategies. Embrace the Power Platform and Power Apps geospatial controls today, and watch your sales insights transform from mere numbers into actionable, game-changing insights.


Elevate your business. Empower your decisions. Embrace the future of sales visualization.




20 views0 comments

Comments


bottom of page