08-02-2017 14:31 PM - last edited 08-02-2017 20:34 PM
Track total invoice amounts over different time periods. Create invoices with different line items, then email the invoice details to recipients.
Common Data Service (Account, Sales invoice, and Sales invoice line entities). For more information about this data source, see The Common Data Service.
Setup and usage info
Author's helpful tips and formula lessons
There are quite a few screens in this app, but we'll focus on the first one for this discussion. Make sure you look at the formulas and what's going on in the other screens. The first screen (HomeScreen) combines a set of elements to build a useful and visually interesting experience:
> The drop-down menu filters the chart to a period of 1 week or 6 months; you could use it to filter other elements on the screen too.
> The screen prominently displays the total amount invoiced, using the following formula:
The formula calculates the sum of all the invoices, then formats the result as US currency to display in a text label.
> The chart provides a quick view of invoices over time, using the following formula for the "Items" property.
If(Dropdown1.Selected.Value="6 months",Filter(SalesInvoiceList, InvoiceDate > DateAdd(Now(), -400,Days)),Filter(SalesInvoiceList, InvoiceDate > DateAdd(Now(), -7,Days)))
This formula shows data from "SalesInvoiceList," filtered based on the drop-down menu.
> In some apps, the "Items" property of the gallery is complex (with filters, sorting, and so on), but the individual items are just pulled in directly from the data source. In this screen, it's the opposite case. The "Items" property is set to the following formula:
In other words, pull in all the data from the Sales invoice entity.
> Within the gallery, the formula for one of the items (the sales invoice total) is fairly complex:
Text(Sum(Filter('Sales invoice line',SalesInvoice.SalesInvoiceId=ThisItem.SalesInvoiceId),LineAmount),"[$-en-US]$##,###.#")
The data source for the gallery is Sales invoice but this formula also references Sales invoice line. For each sales invoice, the formula looks up the line items, totals the "LineAmount" values, and formats the result as US currency. This pattern of referencing both a master and details table in a gallery can be very useful.
Other Relevant Blogs and Online Resources
Understand variables in PowerApps (collections and context variables)