Forum Discussion
Dax Formula Between Dates
- 7 years ago
Hi,
Try this measure
Measure1 = CALCULATE([Actual Cost],DATESBETWEEN('Calendar'[Date],IF(MONTH(TODAY())>=9,DATE(YEAR(TODAY()),9,1),DATE(YEAR(TODAY())-1,9,1)),IF(MONTH(TODAY())=9,TODAY(),EDATE(TODAY(),-1))))
Hope this helps.
- 7 years ago
Hi,
Try this measure
Actual Cost since inception = CALCULATE([Actual Cost],DATESBETWEEN('List Period'[Date],MINX(ALL('Calendar'[Date]),'Calendar'[Date]),IF(MONTH(TODAY())=9,TODAY(),EDATE(TODAY(),-1))))
Hope this helps.
Hi,
Try this measure
Measure1 = CALCULATE([Actual Cost],DATESBETWEEN('Calendar'[Date],IF(MONTH(TODAY())>=9,DATE(YEAR(TODAY()),9,1),DATE(YEAR(TODAY())-1,9,1)),IF(MONTH(TODAY())=9,TODAY(),EDATE(TODAY(),-1))))
Hope this helps.
Hi Ashish_Mathur ,
Thanks again for your measure ... Now I would like to do another measure Similar to this but instead of begining from September Last year I would like to consider ALL previous dates till Last month May'19 (or EndOfMonth) from my model .. per example My model have information since July 2016 so I would like to calculate from July 2016 to May'19 with a similar measure you provided to me:
- Ashish_Mathur7 years agoSuper User
Hi,
Try this measure
Actual Cost since inception = CALCULATE([Actual Cost],DATESBETWEEN('List Period'[Date],MINX(ALL('Calendar'[Date]),'Calendar'[Date]),IF(MONTH(TODAY())=9,TODAY(),EDATE(TODAY(),-1))))
Hope this helps.
- cristianml7 years agoPost Prodigy
Hi Ashish_Mathur ,
I tried the measure but is not working.. Is showing same amount that Previous one (YTD). I think the problem is that the following part needs to be removed but not sure how:
,IF(MONTH(TODAY())=9Thanks, - cristianml7 years agoPost Prodigy
Hi Ashish_Mathur ,
Finally it worked.. I only removed the September part leaving the formula like this:
CTD Actual Cost = CALCULATE([Actual Cost],DATESBETWEEN('List Period'[Date],MINX(ALL('List Period'[Date]),'List Period'[Date]),EDATE(TODAY(),-1)))Thanks ! Regards.