Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I have to display the sales of 10 last days so I will see in a column of a table ten rows and yesterday's sales at the top, the sales of 2 days ago below and so on. and in I have some fields to achieve that: sold_date which is the date where the ticket was sold, quantity is the number of tickets sold, so I would need sum(quantity).
I am currently trying to load specific data in the load editor from a table I already have, but I think it could be much easier to use an expression in a chart to achieve it.
This is the code I am using in the load editor that doesn´t work anyway ( sth relate to the where clause):
LOAD
DATE(sold_date) AS date,
SUM(quantity) AS total_sales;
[marts_event_ticketing]:
SELECT "sold_date",
"quantity"
FROM
"dbt_xavi_marts"."marts_event_ticketing"
WHERE
Date(sold_date) >= $(=Date_Add('$(=Today())', -10))
GROUP BY
DATE(sold_date);
Any clue? Many thanks!!
Is the 'sold_date' properly formatted and ensure it conforms with the format in the expression.
This expression will sum the quantities sold for the last 10 days based on the user's selection of dates.
Sum({<sold_date={">=$(=Date(Max(sold_date)-9, 'YYYY-MM-DD')) <=$(=Date(Max(sold_date), 'YYYY-MM-DD'))"}>} quantity)
Looked great but it didn´t work. I created a table and added a column with this expression and just a zero appears. I tried to add sold_date as a dimension and it was a null and a zero then.
I did this instead:
Is the 'sold_date' properly formatted and ensure it conforms with the format in the expression.
It worked. I had another format when loading.
Thank you again BrunPierre!!