Power Apps License calculator
Tags: powerplatform, powerapps, licensing
Published: 2024-02-01 07:45:22

It's not all that easy to "get a feeling" about the license cost for Power Apps. 
Even if we consider that Per User is 4 times the price of Per App (per user/per app) and pay-as-you-go(per active user/per app) is half the price of Per User, I cannot easily foresee how the total license cost will develop, and what would be the best option under different circumstances. 

My [Power Apps License Calculator](https://adoption.microsoft.com/en-us/sample-solution-gallery/sample/pnp-powerplatform-samples-license-calculator/) sample, published only yesterday, provides a visual representation of the cost:
![license price](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3imczhd98t85c3xr0fog.gif)
and the best license type for different usage scenarios:
![license type](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/850n2zjy2b2hzggnixl5.gif)

The sample consists of a reusable component, and a Canvas App. After importing the solution, you may embed the component in your own application, and configure it with your own Volume Licensing prices.

## How to configure the component

The license cost per user, the currency and the initial percentage of the active users are all accessible via component's **Custom properties**. "Show info" toggle allows you to decide if you want to display the "legend"- the information about acronyms used when multiple license types result in the same price.

![Custom properties](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7zd3ukdm0sqm1nosl4bv.png)

### And anything more advanced?
In case you'd like to display different amount of apps and users, edit the component's `onReset`:

```js
ClearCollect(
    colUsers,
    Table(
        {userCount: 1},
        {userCount: 10},
         //...
        {userCount: 5000}
    )
);
ClearCollect(
    colApps,
    Table(
        {appCount: 1},
        {appCount: 2},
        {appCount: 3},
        {appCount: 4},
        //...
        {appCount: 3000},
        {appCount: 5000}
    )
);
```

The matrix source is automatically recalculated based on these two collections, and the license cost component parameters. 
There are some additional columns in `colLicenses`, currently not used in the control. Perhaps you want to use them to display additional information when user hovers over the cell?
This is also the place where you can change the cell [colors](https://color.adobe.com/explore), in case the current theme is not your cup of tea.

```js
ForAll(
    colApps ,
    ForAll(
        colUsers,
        Collect(
            colLicenses,
            //...
             {
                        Type: If(CountRows(matches)>1,Concat(matches,Left(type,1),"/"),First(matches).type) ,
                        Price: First(matches).price,
            //...
            }
```
The resulting `colLicenses` collection is provided as a gallery source:

![configuration](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nt5scfibcnn2adla6x4x.png)

In order to display it in a matrix format, I'm setting `wrap` parameter of the gallery to the length of the users' collection. 
In case you decide to change the `colUsers`, make sure that this setting is updated if necessary.

Such a simple solution to such a complicated problem. =)