Hi Team,
I want to display today price and yesterday price in tabular format.
how to get yesterday price.
Hi Team,
I want to display today price and yesterday price in tabular format.
how to get yesterday price.
Hi @Alam_Syed
You can calculate Today’s and Yesterday’s price using addDateTime
and truncDate
functions. Try the following calculations.
Example:
Yesterday_Price =
ifelse(
datefield = truncDate('DD', addDateTime(-1, 'DD', now())),
pricefield,
NULL
)
Today_Price =
ifelse(
OrderDate = truncDate('DD', now()),
Sales,
NULL
)
Please refer to the below documentation this might be helpful for you.
Hi @Xclipse , thank you so much for quick reply,
I would like to see the data based on the data available.
not now function.
Hi @Alam_Syed
Previous response calculation logic will display the Today’s Price and Yesterday’s Price based on the available data from your dataset. Replace the date and price fields from your dataset.
If data for Today or Yesterday is missing, it will simply show a blank for that day without causing any errors.
Hi @Xclipse,
but is there any way to see the simple previous day price,
ex:
Date | Price | Previous day price |
---|---|---|
01-01-2025 | 12 | 12 |
02-01-2025 | 13 | 12 |
03-01-2025 | 14 | 13 |
04-01-2025 | 20 | 14 |
Hi @Alam_Syed
Thanks for explaining with example.
Using lag() function we can calculate the previous value for a measure based on specified partitions and sorts.
Example:
Note - Replace the fields from your dataset.
coalesce(
lag(sum(Sales), [OrderDate ASC], 1),
sum(Sales)
)
Hi @Xclipse,
after applying this calculation I am getting error
( Table calculation attribute reference(s) are missing in field wells)
Hi @Xclipse
When we are using the Name as filter when we are selecting the single Name as filter then its working fine.
If we are selecting Name as All then data its calculating as sum.
Is it possible to remove the sum in calculation it will be good.
Thanks
Syed
Hi @Alam_Syed
Sorry, no. Lag function measure requires aggregation. Please refer to the following documentation, it might be helpful.