Skip to main content
Showing results for 
Search instead for 
Did you mean: 

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

New Member

DAX Measure not giving correct result when I add conditions for dates.

I've got the following measure 


Test 2 (Manual) =
'Treatments'[Treatment Status] = "Completed" &&
Treatments[Treatment Date] <= [End Month 2]  &&
Treatments [Treatment Date] >= [Start Month 2])))
End Month 2 is 31/05/2023 23:59:59 and Start Month 2 is 01/05/2023 00:00:01
Start Month 2 and End Month 2 are calculated based on a slicer value, so for example if I select 21/06/2023, as my end date on the slicer, then Start and End Month 2 will be calculated based on these dax measures.
Start Month 2 = EOMONTH(MAX(Treatments[Treatment Date]), -2) + 1 + time(0,0,1)
End Month 2 = EOMONTH([End Month 1], -1) + time(23,59,59)
When I calculate Test 2 (Manual), it gives me a result of 13610 which is incorrect, it should be 2652. I'm not sure of what I am doing wrong, I already configured the card that displays the value so that it ignores the slicer and doesn't try to calculate it based on that, but the value is still wrong. What could I do to fix this?
Community Support
Community Support

Hi @sam95 ,


Please try:

Start Month 2 = EOMONTH ( MAX ( Treatments[Treatment Date] ), -2 ) + 1 + TIME ( 0, 0, 1 )
End Month 2 = EOMONTH(MAX(Treatments[Treatment Date]), -1) + TIME ( 23, 59, 59 )


Best Regards,

Community Support Team


If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Helper V
Helper V

Startmonth 2 = DATE(YEAR(MAX([Date])), MONTH(MAX([Date]))  - 1, 1)
Endmonth 2 = EOMONTH(MAX([Date]), -2)

Helpful resources

Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors