Can I use `SELECT MIN(someAttr)` where `someAttr` ...
# gooddata-platform
t
Can I use
SELECT MIN(someAttr)
where
someAttr
is a numeric Attribute?
Or more concrete: Lets assume I have given a fact table with a running
transaction number
(integer attribute), an
account number
(numeric reference to a dimension) and a
balance
(numeric fact):
Copy code
account number | transaction number | balance
1              | 101                | 100
1              | 102                | 300
1              | 103                | 50
2              | 101                | 0
2              | 102                | 300
2              | 103                | 500
the transaction number is indicating the order of transactions within one account
How could I build a metric that gives me the balance for the smallest transaction number (aka at the beginning of the selected period)
Copy code
account number | transaction number | balance | start balance
1              | 101                | 100     | 100
1              | 102                | 300     | 100
1              | 103                | 50      | 100
2              | 101                | 0       | 0
2              | 102                | 300     | 0
2              | 103                | 500     | 0
so, a result like this one
please disregard. I solved it by turning transaction number into a fact
🙌 1
m
Hi Tomas, it’s also possible to get the dates of the latest/earliest values in a dataset. I recommend reading: How can I custom a attribute or metric in Date format? | The GoodData Community and Finding Min and Max Dates Using Date Arithmetic | GoodData Classic
t
I knew those, but we had date granularity with multiple transactions per day, so the transaction number was on a finer grain
1