Forum Discussion
Calculate sum() according to a date range
Hello,
Here is a sample of my table :
| ID | Name | Start_date | End_date | Current | value |
| 1 | A | 1999-01-01 | 2999-01-01 | 1 | 15 |
| 2 | B | 1999-01-01 | 2023-03-22 | 0 | 10 |
| 3 | B | 2023-03-22 | 2999-01-01 | 1 | 20 |
| 4 | C | 1999-01-01 | 2999-01-01 | 1 | 35 |
| 5 | D | 1999-01-01 | 2023-06-25 | 0 | 10 |
| 6 | D | 2023-06-25 | 2999-01-01 | 1 | 63 |
I have a linked table that contains a date : Validate_date
I want to calculate a SUM(Value) where valide_date falls between Start and End_date.
For Example : for 😧 if Validate_date is between 1999-01-01 & 2023-06-25 I use 10 in the calculated measure, otherwise, 63.
I've tried to calculate a new column as follow :
Total_Value =
IF (SELECTEDVALUE('Tabl1'[Validate_date]) >= SELECTEDVALUE(Tab2[Start_date]) && SELECTEDVALUE('Tabl1'[Validate_date])<SELECTEDVALUE((Tab2[End_date]),1,0)
)
I got only 0 . So doesn't work.
Can anyone help on how to calculate this measure?
Thanks a lot.
Nissa
- Anonymous2 years ago
Hi Nissa23 ,
I made simple samples and you can check the results below:
An attachment for your reference. Hope it helps!
Best regards,
Community Support Team_ Scott ChangIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.
4 Replies
- AnonymousNot applicable
Hi Nissa23 ,
I made simple samples and you can check the results below:
An attachment for your reference. Hope it helps!
Best regards,
Community Support Team_ Scott ChangIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.
- Nissa23
Helper I