3 Replies Latest reply on Aug 7, 2018 8:22 AM by Dave Merideth

    Net weight loss

    Dave Merideth



      I'm trying to build a dashboard to be used in a nutrition management clinic. It pulls weight measurements by patient from our EHR. I've made a graph, but I can't figure out how to show the net loss (or gain) from the first measurement to the most recent measurement.


      In plain English, I want to take the weight from the oldest date and subtract the weight from the newest date.


      I've tried several different ways of doing this (from examples on this forum) but I always get stuck at a 'cannot mix aggregate and non aggregate..." error...


      I've attached a packaged workbook.


      Thanks for the help!



        • 1. Re: Net weight loss
          Naveen B

          HI Dave,


          Create a calculation like below


          You will get the desired O/p


          for MRN 196896 , min date is : 16-08-2013 and the value is 159

          and max date is 03-08-2018 and the value is 163 so difference is -4


          Hope this helps kindly mark this answer as correct or helpful so that it will help others




          1 of 1 people found this helpful
          • 2. Re: Net weight loss
            Mahfooj Khan



            Find my approach below,


            CASE [qo]

            WHEN "Weight" THEN

            IIF({FIXED [mrn]:MIN([clinicaldate])}=[clinicaldate],[value],0)


            IIF({FIXED [mrn]:MAX([clinicaldate])}=[clinicaldate],[value],0)



            "cannot mix agg and non-agg..." this error comes when we don't aggregate any of dimension/measure in our condition while using aggregate function in our calculations.


            Let us know if this help.



            1 of 1 people found this helpful
            • 3. Re: Net weight loss
              Dave Merideth

              Both of these solutions worked perfectly. Thank you so much!