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

Joining Tables In DAX

Marco Russo bridges a gap in moving from SQL to DAX: The SQL language offers the following types of JOIN: INNER JOIN OUTER JOIN CROSS JOIN The result of a JOIN does not depends on the presence of a relationship in the data model. You can use any column of a table in a JOIN […]

Read More

Getting Month Names Given Numbers In DAX

Philip Seamark shows how to convert month numbers into names in Power BI: The most common solution I see offered is along the lines of a SWITCH statement that lists 12 conditions (one for each month).   This works, but can also be done using existing functions. While DAX lacks a dedicated function to convert a […]

Read More

Categories

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