The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hello,
I want to get last 4 weeks sum of sales in the table. In below example column "Previous 4 week Sales".
Please can someone help me here.
Week | Product | Sales | Previous 4 week Sales |
1 | A | 10 | |
2 | A | 10 | |
3 | A | 20 | |
4 | A | 30 | 70 |
5 | A | 40 | 100 |
6 | A | 50 | 140 |
7 | A | 60 | 180 |
8 | A | 70 | 220 |
9 | A | 80 | 260 |
10 | A | 90 | 300 |
1 | B | 5 | |
2 | B | 5 | |
3 | B | 5 | |
4 | B | 10 | 25 |
5 | B | 15 | 35 |
6 | B | 20 | 50 |
7 | B | 25 | 70 |
8 | B | 30 | 90 |
9 | B | 35 | 110 |
10 | B | 40 | 130 |
Solved! Go to Solution.
You may add a calculated column as shown below.
Column = VAR p = Table1[Product] VAR w = Table1[Week] RETURN IF ( w >= 4, SUMX ( FILTER ( Table1, Table1[Product] = p && Table1[Week] > w - 4 && Table1[Week] <= w ), Table1[Sales] ) )
You may add a calculated column as shown below.
Column = VAR p = Table1[Product] VAR w = Table1[Week] RETURN IF ( w >= 4, SUMX ( FILTER ( Table1, Table1[Product] = p && Table1[Week] > w - 4 && Table1[Week] <= w ), Table1[Sales] ) )
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
83 | |
75 | |
51 | |
42 |
User | Count |
---|---|
140 | |
112 | |
72 | |
64 | |
63 |