top of page
Writer's pictureAlan Campbell

ChatGPT Insights: Power Platform & Business Central - Part 3

Updated: Oct 30, 2023

Welcome back to our blog series, where we continue to explore the confluence of Microsoft's Power Platform, Business Central, and the analytical might of ChatGPT. If you've been following along, you'll remember that in our last installment, we designed an intuitive Power App that retrieves Business Central’s Item Ledger details and translates them into a JSON stream. Our Power App can now communicate directly with ChatGPT, thanks to the custom connector we created earlier.


Now, let's venture into a truly captivating phase—Seamless Integration with ChatGPT. In this Part 3 of our series, we'll delve deeper into how we can make specific "asks" to ChatGPT through our Power App. These asks aren't just queries; they are analytical directions that guide ChatGPT in scrutinizing our sales data in the most beneficial way.


We'll walk you through the process of building out these "asks" and show you how ChatGPT responds, turning raw data into actionable business insights. By the end of this chapter, you'll know how to wield the analytical power of ChatGPT effectively, leveraging it to make more informed business decisions.


So, are you ready to unlock the next level of sales analysis and business intelligence? Let's get started!


Ask Clarifications


In our previous installment, we introduced the concept of an askClarification collection within the OnStart trigger of the Power App. This collection serves an essential role: it sets predefined guidelines and format stipulations for interactions with ChatGPT.


For instance, I specify that I'd like ChatGPT to present date outputs in the "yyyy-mm-dd" format. Without this directive, ChatGPT would have the liberty to format the date however it deems appropriate, which could result in inconsistent outputs.


Additionally, I provide translation directives for field names to make them more human-readable. For example, the salesAmount field is instructed to be referred to as "Sales Amount" in ChatGPT's output. This standardization ensures not only consistency but also enhances readability for end-users.


The askClarification collection is automatically submitted to ChatGPT whenever any request is sent to ChatGPT.


// Create the Ask Clarification Collection
ClearCollect(
    askClarification,
    {theClarification: "Refer to salesAmount as Sales Amount. "},
    {theClarification: "Refer to postedDate as Posted Date. "},
    {theClarification: "Refer to itemNumber as Item Number. "},
    {theClarification: "Refer to documentNumber as Document Number. "},
    {theClarification: "Use the $###,##0 format when showing the salesAmount. An example of the $###,##0 format is $11,204. "},
    {theClarification: "Use the yyyy-mm-dd format when showing the postedDate. An example of the yyyy-mm-dd format is 2022-10-23. "}
);

The Asks

In our previous blog, we introduced two fundamental "Asks" or queries: the first aimed at counting the number of documents for a single item number, and the second focused on counting documents for two distinct item numbers.


In today's entry, we're going beyond these basic queries to incorporate more complex asks that are tailored to the end user's requirements. While I've devised a few sample asks to get us started, I encourage you to tap into your creativity and expertise to formulate asks that are more closely aligned with your users' and company's specific needs. Ahead, we'll explore some of these custom Asks along with the insights garnered from ChatGPT's analysis.


Trends Ask


This Ask is a one item Ask. We are asking ChatGPT to analyze the historical trends for this item number.


"Analyze the following sales data and identify any historical trends in the salesAmount."

A Power App that submits a request for a trend analysis to chatGPT based upon Business Central Item Ledger data
One Item Number Trend Analysis by ChatGPT

Consistent Revenue Ask


This Ask is a two item Ask. We are asking ChatGPT to compare two item numbers to determine which item generates a more consistent revenue.


"Analyze the following itemNumbers and determine which item has a more consistent revenue."

A Power App submitting a request to compare revenue consistency to ChatGPT
Two Item Number Consistency Comparison Analysis by ChatGPT

The Asks Collection


Below is an example of how to create an Asks collection. We enter the code in the OnStart trigger for the app. The theOption tag is the description that shows in the dropdown menu. The theComparison tag is a Boolean. Set the option to false for a one item analysis. Set the option to true for a two item analysis. The theAsk tag is the request that is send to ChatGPT.


// Create the ASK Option Collection
ClearCollect(
    askOptions,
    {
        theOption: "Trend",
        theComparison: false,
        theAsk: "Analyze the following sales data and identify any historical trends in the salesAmount. "
    },
    {
        theOption: "Patterns",
        theComparison: false,
        theAsk: "Analyze the following sales data and identify any patterns in the salesAmount. "
    },
    {
        theOption: "Month Patterns",
        theComparison: false,
        theAsk: "Analyze the following sales data and identify any patterns in regard to months in general.  "
    },
    {
        theOption: "Consistent Revenue",
        theComparison: true,
        theAsk: "Analyze the following itemNumbers and determine which item has a more consistent revenue. "
    },
    {
        theOption: "Days Patterns",
        theComparison: false,
        theAsk: "Analyze the following sales data and identify any patterns days within a month. Examples: More sales occurred around the 15th of the month. "
    },
    {
        theOption: "One Item Document Count",
        theComparison: false,
        theAsk: "How many documents are in the data for this itemNumber? "
    },
    {
        theOption: "Two Item Document Count",
        theComparison: true,
        theAsk: "How many documents are in the data for each of the two itemNumbers? "
    }
);

Conclusion


As we wrap up Part 3 of our blog series, let's take a moment to reflect on the strides we've made in integrating Microsoft's Power Platform and Business Central with ChatGPT. Starting with the basics, we've built a robust Power App capable of communicating with ChatGPT through a custom connector. This laid the foundation for creating "Asks"—specialized queries that not only request data but also instruct ChatGPT on how to analyze it.


We've also added layers of sophistication by incorporating an "askClarification" collection, allowing us to predefine formatting and naming standards for more consistent and user-friendly outputs. From simple asks like counting documents for specific item numbers to more complex ones like identifying sales trends and revenue consistency, we've opened up a world of possibilities for data-driven decision-making.


The future is promising. The combination of Power Platform, Business Central, and ChatGPT offers a compelling landscape for anyone looking to harness data for actionable insights. We're no longer just collecting data; we're talking to it, asking it to reveal its secrets, and guiding our businesses with newfound wisdom.


In the next installment, we will dive even deeper, so stay tuned. Until then, I encourage you to experiment with these tools and "Asks" to unlock new levels of understanding and efficiency in your organization. Thank you for joining us on this exciting journey toward a smarter, data-driven future.


35 views0 comments

Comments


bottom of page