Forum Discussion

lisapduan's avatar
lisapduan
Frequent Visitor
1 year ago
Solved

Issue with calculated date range

I have a report I'm trying to modify. There is a memo field on the report that needs to contain a date range based on what dates have been entered into the date slicer. The correct range of dates are pulling but it is listing individuial dates not the date range. For the below I need date range to show as 3/1/2025-3/31/2025 instead of 3/1/2025 - 3/1/2025 or 3/12/2025-3/12/2025. I'm using Min and Max to get start date and end date for the Memo field. I.e.

(

Start Date = CALCULATE(
    MIN(XTable[Calculated date]),
    ALLSELECTED(XTable[Calculated date])
)

Any suggestions? 

 

  • Hi lisapduan ,

    Apologies for any earlier inconvenience. Our testing confirms that the date range logic functions as intended and meets your original requirements.

     

    FYI:

     

     

     

     

     

    From your latest message, it seems a particular relationship in your data model is affecting the date context flow. This explains why the logic worked correctly when that specific table was removed.

    While the DAX solution is robust, you may need to adjust your model setup slightly to ensure everything aligns perfectly.

     

    I have also attached a .pbix file containing a simplified example of the working logic for your reference.

     

    Regards,

    Yugandhar.

     

10 Replies

  • Deku's avatar
    Deku
    Super User

    If the dates are coming from a separate date dimension, use

     

    Var minDt = min(dates[date])

    Var maxDt = max(dates[date])

    Return 

    MinDt & " - " maxDt

  • lisapduan's avatar
    lisapduan
    Frequent Visitor

    They are using the same date dimension. When I try this I get message "Query has exceed available resources and will not reutn anything."

    • Deku's avatar
      Deku
      Super User

      Is it a separate dimension or a date field in the same table?

  • V-yubandi-msft's avatar
    V-yubandi-msft
    Community Support

    Hi lisapduan ,

    Has your issue been resolved, or do you require any further information? Your feedback is valuable to us. If the solution was effective, please mark it as 'Accepted Solution' to assist other community members experiencing the same issue.

    • lisapduan's avatar
      lisapduan
      Frequent Visitor

      This issue has not been resolved and put on the back burner due to other priorities. The issue seems to be more of a realationship issue. When we were backing tracking through the set up we noticed when 1 table was removed, what we were wanting to do worked. It is a critical table though so it has to be there. We are going to rebuild the model from scratch when we have time. The original was built by by someone no longer here.

      • V-yubandi-msft's avatar
        V-yubandi-msft
        Community Support

        Hi lisapduan ,

        Apologies for any earlier inconvenience. Our testing confirms that the date range logic functions as intended and meets your original requirements.

         

        FYI:

         

         

         

         

         

        From your latest message, it seems a particular relationship in your data model is affecting the date context flow. This explains why the logic worked correctly when that specific table was removed.

        While the DAX solution is robust, you may need to adjust your model setup slightly to ensure everything aligns perfectly.

         

        I have also attached a .pbix file containing a simplified example of the working logic for your reference.

         

        Regards,

        Yugandhar.

         

  • V-yubandi-msft's avatar
    V-yubandi-msft
    Community Support

    Hi lisapduan ,

    May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

    Thank you.

  • V-yubandi-msft's avatar
    V-yubandi-msft
    Community Support

    Hi lisapduan ,

    We noticed we haven't received a response from you yet, so we wanted to follow up and ensure the solution we provided addressed your issue. If you require any further assistance or have additional questions, please let us know.

    Your feedback is valuable to us, and we look forward to hearing from you soon.