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

Multi-Parameter Website Scraping With Power Query

Callum Green shows how to build up a URL based off of multiple parameters, scraping data from a page for each permutation of parameters: The sections highlighted in red are the parameters and sit in between some of the hard-coded URL text Code Breakdown: –          Text = http://www.boxofficemojo.com/monthly/?page= –          Parameter = [Page] –          Text = &view=calendargross&yr= –          Parameter = [Year] –          Text = &month= –          Parameter […]

Read More

Heat Streams Custom Visual

Devin Knight continues his Power BI custom visuals series: In this module you will learn how to use the Heat Streams Custom Visual.  The Heat Streams visual allows you to visualize and compare a categorical value over time. This looks pretty interesting when comparing a number of elements over time—more elements than a line chart […]

Read More

Categories

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