Forum Discussion
How to take To Date from Date range using Dax
- Anonymous2 years ago
Hi,
Try the following dax formula.Previous year = CALCULATE(SUM('Table'[Sales]), FILTER(ALL('Table'), 'Table'[Date] <= MAX('Table'[Date]) && 'Table'[Year] = YEAR(TODAY())))Best Regards,
Wisdom Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous ,
Please try the following methods:
1.Create the sample table.
2.Create the new measure to calculate previous period and previous year.
Previous year = CALCULATE(SUM('Table'[Sales]), FILTER(ALL('Table'), 'Table'[Year] = YEAR(MAX('Table'[Date])) - 1))Previous preiod = CALCULATE(SUM('Table'[Sales]), DATESBETWEEN('Table'[Date], MIN('Table'[Date]), MAX('Table'[Date])))
3.Drag the measures into the card visual. Select the to date.
Best Regards,
Wisdom Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
this Dax is considering From date or base on To Date as I need to work from To Data only
Previous preiod = CALCULATE(SUM('Table'[Sales]), DATESBETWEEN('Table'[Date], MIN('Table'[Date]), MAX('Table'[Date])))- Anonymous2 years agoNot applicable
Hi,
Try the following dax formula.Previous year = CALCULATE(SUM('Table'[Sales]), FILTER(ALL('Table'), 'Table'[Date] <= MAX('Table'[Date]) && 'Table'[Year] = YEAR(TODAY())))Best Regards,
Wisdom Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.