Forum Discussion
joshua1990
Post Prodigy
3 years agoCalculate Range between Dates for each Article
Hi community!
I have a transactional table that shows me multiple dates for each article:
| Article | Date |
| A | 01.01.2021 |
| A | 05.02.2022 |
| A | 01.01.2023 |
| B | 08.01.2023 |
Now I would like to get a table as a result that shows me the range in days for each date entry for each article
| Article | Date | Range in Days |
| A | 01.01.2021 | |
| A | 05.02.2022 | 400 |
| A | 01.01.2023 | 330 |
| B | 08.01.2023 |
How is this possible with DAX?
1 Reply
- tamerj1
Community Champion
Hi joshua1990
Please try= VAR Dates = CALCULATETABLE ( VALUES ( 'Table'[Date] ), ALLEXCEPT ( 'Table', 'Table'[Article] ) ) VAR StartDate = MINX ( Dates, 'Table'[Date] ) VAR EndDate = MAXX ( Dates, 'Table'[Date] ) RETURN DATEDIFF ( StartDate, EndDate, DAY )