Still exploring the basics of QS and bumped into the issue which i am trying to resolve.
I am using the first value function over a simple data set, which is shown on the table below:
The function in the E column returns the first sorted value across whole table
Question - is there a way of calculating the first sorted value only from the specific data range? For example, where the Flag=1
Let me know please what your thoughts are
Many thanks!
Yes, you can use the relative date filter to apply two dates for filtering data, as shown in the image. The firstValue function will select values based on the applied filter.
For example, based on the screenshot you posted, if you have a field called “flag”, you can filter by a “1” value or apply a date filter between 04-01-2024 and 08-01-2024. The firstValue function will then pick the value 160.
Thanks!
But it’s not exactly what i need. The way of filtering you propose is on the whole table, but i need just the firstsorted value to reach on that filter.
Further more, the first sorted value will be a part of another calculation, so i was thinking if there’s a way of setting up the filter in the formula itself like firstvalue(ifelse(Flag=1, Avg({Amount})), [Date ASC])
Could you please confirm that there’s no such a possibility in QS?
Thank you!
I have a better idea on how the if statement can be included as the filter.
However, using the below formula that goes through the Date (Main) field, it doesn’t work
Sorry for the late reply
On the picture below i reproduced the whole calculation which i eventually need in QS:
A - F columns would be my dataset input
G & H columns - these are the final calculations (we call them cumulative position metrics), which i need to represent in QS line chart on the date field.
A few details how G & H columns are calculated - they are combined of 2 calculations:
Start balance per bank account on the very first start date (actuals or forecast)
Think i am very close to achieve what i need.
Apart from the main graph which contains running total movements only, i have also calculated the start balances for both actuals and forecast in straight table (the last 2 columns):
Please try the following formulas for the Actual Position and Forecast Position. They match exactly the same values you posted in this thread. Unfortunately, you can’t use these calculated fields in a line chart because they are visual-level calculations and multiple fields are associated with them.
Thanks for sharing this
My goal is to get the line chart with:
TransactionDate field (it’s not calculated field, but the one that comes directly from the dataset)
Actuals Position (1 metric)
Forecast Position (2 metric)
I can calculate them now in the straight table, but with the current formula version, they require the presence of other fields like Balance Actuals, Actuals Amount, etc.
So in short, i am looking for the solution how the firstvalue formula can calculate exactly the same Actuals and Forecast Start Balances with ONLY 1 dimension - TransactionDate.
Sorry, I’m out of ideas. I would recommend filing a case with AWS Support where we can dive into the details so that we can help you further. Here are the steps to open a support case. If your company has someone who manages your AWS account, you might not have direct access to AWS Support and will need to raise an internal ticket to your IT team or whomever manages your AWS account. They should be able to open an AWS Support case on your behalf. Hope this helps!