Last Item In Each Group

Reza Rad shows how to get the last item in each group using Power Query:

Scenario that I want to solve as an example is this:

FactInternetSales has sales transaction information for each customer, by each product, each order date and some other information. We want to have a grouped table by customer, which has the number of sales transaction by each customer, total sales amount for that customer, the first and the last sales amount for that customer. First and last defined by the first and last order date for the transaction.

In T-SQL, this sounds like the job of window functions.  In Power BI, we write M.

Related Posts

Visuals I Like

I continue my series on dashboard visualization: This leads me to a little bit of advice for choosing bars versus columns.  You will want to choose a bar chart if the following are true: Category names are long, where by “long” I mean more than 2-3 characters. You have a lot of categories. You have relatively few […]

Read More

Measuring Progress With Power BI

Stacia Varga shows how to use Power BI to simplify data analysis, using the example of New Year’s resolution goals: First, the actual data represents the accumulation of data by day from the beginning of the year, whereas the target data represents the final tally at the end of a defined period. Each goal has […]

Read More

Categories

August 2016
MTWTFSS
« Jul Sep »
1234567
891011121314
15161718192021
22232425262728
293031