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
Hi. Would someone able to help me with the below?
I need to calculate a new column named "Total Outbound FINAL". This columns will need to sum the last 7 "Total Outbound" column rows values
- For example if I want to calculate 2023-W10 like below I will need to perform the calculation
86 + 317 + 353 + 301 + 339 + 254 + 308 = 1958
Calculating the first rows is fine as you can see in the screen above.
My question is how to calculate the next row and also include 2023-W10 as one of the 7 previous row??? So my 2023-W11 should be:
1958 + 86 + 317 + 353 + 301 + 339 + 254 = 3608
The expected result should be like this
Thanks
To calculate the rolling sum of the last 7 rows of the "Total Outbound" column, you can use the DAX function called SUMX. Here is the formula you can use:
In this formula, replace 'your_table_name' with the actual name of your table, and 'YearWeek' and 'Total Outbound' with the names of your columns.
This formula uses the MAX function to get the maximum value of the "YearWeek" column, and then uses MAXX to get the maximum value of the "YearWeek" column in the previous row. It then filters the table to include only the rows with a "YearWeek" value less than or equal to the maximum "YearWeek" value, and greater than the maximum "YearWeek" value minus 7 (to get the last 7 rows). Finally, it sums the "Total Outbound" column for these filtered rows.
Note that this formula assumes that your "YearWeek" column is formatted as text in the format "YYYY-W##". If it's formatted differently, you may need to adjust the formula accordingly.
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.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
21 | |
18 | |
16 | |
15 | |
14 |
User | Count |
---|---|
37 | |
33 | |
22 | |
18 | |
18 |