From the course: Excel: Creating a Dashboard with Power Query (Microsoft 365)

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

Create logic for the latest and previous month in Power Query

Create logic for the latest and previous month in Power Query

From the course: Excel: Creating a Dashboard with Power Query (Microsoft 365)

Create logic for the latest and previous month in Power Query

- [Instructor] As a next step, let's try to figure out how we can identify which month is the latest month and which month is the previous month. 'Cause if we take a look at our draft here, any time we press Refresh, we want to grab the data for the latest month. So somehow we need to flag this in our dataset. Now, we can create this logic either in the Power Pivot side or the Power Query side. In this example, I'm going to do it in the Power Query side. Let's bring up our queries. Data, Queries and Connections. We have the dates in the SalesData query. This is our fact table. This is where we collect all the details about the orders. Now, notice, our dates here are obviously repeated because we have many orders on the same day. What we want to do is to create a separate query that holds unique values for the dates here. Now, you could create a separate calendar table from scratch in Power Query, and that table could…

Contents