Hi, can some help me to create the most recent dat...
# gd-beginners
c
Hi, can some help me to create the most recent date and the value of this day. Usually, it's yesterday. But sometimes the data wasn't loaded in time, we still want to show the data of most recent date. I've created "max date", but can't get it to show on the canvas
j
Hi Cathy, Are you simply trying to display the most recent date as a value? There is a slight trick to do this if that is the goal. However, what else are you trying to add to your visualization using MAX?
c
Thanks Joseph. Is there any way to display the max_date on the dashboard? We want to let our customers know when the data was last updated.
j
Ok, let me double-check to see if we have someway to record this
m
Hi Cathy, let me clarify. If I understand correctly, you want to display the value (fact or metric) associated with the most recent date (maximum date) on your dashboard, correct? To achieve this, we can use a MAQL metric that identifies the maximum date and retrieves the corresponding value. Please note the example, as mentioned in the documentation provided by my colleague Joseph. I've tested this on my end, and here’s the MAQL I used:
Copy code
SELECT SUM({fact/totalamount}) 
WHERE {label/SaleDate.day} =
      (SELECT MAX({label/SaleDate.day},{dataset/salesdata}) BY ALL OTHER)
As you can see in the screenshot, I got the 'value' for the maximum date (2/17/2025). Please note that if you have multiple rows with the same maximum date, this metric will sum the values for all of those rows. Is this what you were aiming to achieve?
c
Thanks Mauricio, I've tried to mimic your calculation, but it seems I can't get the {dataset/salesdata} to pop up automatically. However, when I enter it manually, I get an error. Do you know what's wrong with my end?