Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi
I am working on sales data by month. Every month I get fresh monthly sales data, so I keep appending my query.
For example in November I have data:
Data of company A:
| Month | Sales |
| 1 Aug 2019 | 100 |
| 1 Sep 2019 | 120 |
| 1 Oct 2019 | 110 |
Then next month, in December by Query will become,
Data of company A
| Month | Sales |
| 1 Aug 2019 | 100 |
| 1 Sep 2019 | 120 |
| 1 Oct 2019 | 130 |
| 1 Nov 2019 | 107 |
Now at any point of time, Regardless of the current month, I always want to produce a table with sales for 1) previous month and 3) average sales of the past 3 months.
So my latest table will look like this
| Company | Previous month ( ie Oct) | Previous 3 months avg sales (Aug- Oct) |
| A | 130 | 116.66 (ie avg of 130+ 120+110) |
How can I create measure for Past 3 month sales, using dynamic dates?
For the first column, I successfully used:
Recent month sales
Solved! Go to Solution.
Hi
One way is to add a flag on your calendar that marks the last 3 month dates as true and the rest as false(1,0).
Then
calculate(sum(expression) , Calendar[Past 3 Months Flag] = 1)
Let me know if this helps.
Tomas
Hi
One way is to add a flag on your calendar that marks the last 3 month dates as true and the rest as false(1,0).
Then
calculate(sum(expression) , Calendar[Past 3 Months Flag] = 1)
Let me know if this helps.
Tomas
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 6 | |
| 6 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 21 | |
| 11 | |
| 9 | |
| 5 | |
| 5 |