Forum Discussion
Calculating daily number changes
Hi Team, I have a simple table with 4 rows.
| Snapshot_date | new_enr | returning_enr | total_enr |
| 15/09/2023 | 100 | 50 | 150 |
| 16/09/2023 | 200 | 100 | 300 |
| 17/09/2023 | 300 | 150 | 450 |
| 18/09/2023 | 400 | 200 | 600 |
| 19/09/2023 | 500 | 250 | 750 |
| 20/09/2023 | 600 | 300 | 900 |
I tried a few different codes but it's not working.
I just need a code to calculate the daily changes in numbers across these dates for 'new_enr' ,'returning_enr' and 'total_enr'.
So for example for daily changes in number for new_enr 1for the 16/09/23 would be 100 since its 100 more than 15/09/23 and likewise 50 for 'returning_enr' and 150 for'total_enr'.
Thanks all.
Hi DAX_Noob8212 for column total_enr to get daily change do following
Create Calendar / Date table and connect with your tableCreate following measure (3) and you will get Output
Did I answer correctly? Kudos appreciate / accept solution.
Sum of total enr measure = SUM(Sheet1[total_enr])sum total enr previous measure =CALCULATE(SUM(Sheet1[total_enr]),DATEADD('Date'[Date],-1,DAY))diff total enr measure =VAR __total_enr=[Sum of total enr measure]VAR __total_enr_prev=[sum total enr previous measure]RETURN __total_enr-__total_enr_prevOutput
2 Replies
- some_bihCommunity Champion
Hi DAX_Noob8212 for column total_enr to get daily change do following
Create Calendar / Date table and connect with your tableCreate following measure (3) and you will get Output
Did I answer correctly? Kudos appreciate / accept solution.
Sum of total enr measure = SUM(Sheet1[total_enr])sum total enr previous measure =CALCULATE(SUM(Sheet1[total_enr]),DATEADD('Date'[Date],-1,DAY))diff total enr measure =VAR __total_enr=[Sum of total enr measure]VAR __total_enr_prev=[sum total enr previous measure]RETURN __total_enr-__total_enr_prevOutput
- DAX_Noob8212New Member
This is great! Thanks!