Forum Discussion
Store SUM from table 1 in table 2
Hello smart people.
I am new to Power Bi, DAX and I need some help.
I have table 1 in Power Bi where I have list of different part numbers with current stock levels. I am then projecting closing stock values for each week.
Question 1: How to create Table 2 in Power BI using DAX and store total closing stock from Table 1 for each week ?
Question 2: Is it possible to store result of calculation from table 1 as values in table 2, so as soon as week finished, numbers for that week are captured and they don't change everytime I press "Refresh". To do this in excel I would take cell with formula and copy/paste as values.
I am able to do this in Excel, but I want to do this in Power BI, so I don't need Excel (middle man) to do the calculation.
| ||||||
| Table 1 | ||||||
| Part Number | Current Stock | Week 1 Closing stock | Week 2 Closing stock | Week 3 Closing stock | Week 4 Closing stock | etc --> |
| A123 | 10 | 15 | 20 | 18 | 16 | |
| B123 | 10 | 15 | 20 | 18 | 16 | |
| C123 | 10 | 15 | 20 | 18 | 16 | |
| D123 | 10 | 15 | 20 | 18 | 16 | |
| E123 | 10 | 15 | 20 | 18 | 16 | |
| etc | ||||||
| Table 2 | ||||||
| Weeks | Total Closing stock | |||||
| Week 1 | 75 | |||||
| Week 2 | 100 | |||||
| Week 3 | 90 | |||||
| Week 4 | 80 | |||||
Massive thanks.
R
10 Replies
- ryan_mayu
Super User
Q1: Edit queries and unpivot columns (in the transform tab). That can switch columns with rows.
Q2: build relationship between two tables, then you can use calculate(sum(amount), week="week1"). I am also a new users and hope that can help you.
- r_zFrequent Visitor
Hi Ryan
Thanks for reply.
Q1: For table 1 I have database connection with base data, I then adding DAX calculation columns to do projection and these columns not appearing in Power Querie. It looks like that I have to use either DAX or Power Querie, but not both at the same time.
Q2: calculate(sum(amount), week="week1") - this would sum totals only for Week 1, but how to "tell table 2" that for Week 1 it has to take sum from Week 1 (Table 1), for Week 2 sum from Week 2 (Table 1), for Week 3 sum from Week 3 (Table 1) etc... and all this happens in the same column.
- r_zFrequent Visitor
bump