Forum Discussion

M_SBS_6's avatar
M_SBS_6
Icon for Helper V rankHelper V
2 years ago
Solved

Max Date today

Hi,

 

I have the following table which outputs incorrectly.

 

Val uses this dax of which I had hoped it would bring in the latest Val which it does, but I need the Val to return when AppDate is today.

 

Latest Val = Calculate(sum(app[Val]), filter(app,app[appdate] = MAX(app[appdate])))

 

From the example below, AppNo 36 is dated 22/12/2023 and AppNo 40 is dated 03/01/2024, AppNo 23 and AppNo28 are today's. My logic returns 36 and 40 as for those records, it's the max date and my logic pulls it in. 

 

App. AppName AppNo. Val

New. Rem. 23. 200

New. House. 28. 700

New. FA. 36. 600

RYY. Rem. 38. 500

RYY. House. 40. 209

 

What I need it to say is if MAX appdate <> today then 0 else my logic above any my table should then output like this 

 

App. AppName AppNo. Val

New. Rem. 23. 200

New. House. 28. 700

RYY. Rem. 38. 500

 

Or an easier way to put it, if Max appdate = today then appval else blank 

 

Any ideas please on how to resolve? 

  •  

    Latest Val = Calculate(sum(app[Val]),
              filter(app,app[appdate] = MAX(app[appdate]) && MAX(app[appdate]) = TODAY() )
      )
    

     

     

    Try this?

3 Replies

  •  

    Latest Val = Calculate(sum(app[Val]),
              filter(app,app[appdate] = MAX(app[appdate]) && MAX(app[appdate]) = TODAY() )
      )
    

     

     

    Try this?

    • M_SBS_6's avatar
      M_SBS_6
      Icon for Helper V rankHelper V

      Thanks for your help but the second logic I get a error saying that too many arguments were passed to the filter function.

       

      The first logic works perfectly, thank you! 

      • sevenhills's avatar
        sevenhills
        Icon for Super User rankSuper User

        I removed the second DAX.

         

        Glad to hear that it worked! Thanks