Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello together,
I have the following table:
Datenpunkt_ID | Datum | Uhrzeit | M_Wert | Text | B_Wert |
978 | 2016-12-07 | 18:04:00.000 | 14,19288 | 14.192876 | 62,43 |
978 | 2016-12-09 | 08:30:00.000 | 14,18683 | 14.186826 | 62,39 |
978 | 2016-12-09 | 16:06:00.000 | 14,1875 | 14.187500 | 62,4 |
978 | 2016-12-09 | 20:01:00.000 | 14,18683 | 14.186826 | 62,39 |
978 | 2016-12-10 | 08:02:00.000 | 14,18817 | 14.188171 | 62,4 |
978 | 2016-12-10 | 18:04:00.000 | 14,18951 | 14.189514 | 62,41 |
I woud like to show with the peek function the last upload value from B_Wert:
I tried with the function:
Peek('B_Wert',-1,'MeasurementValues')
But I get allways an error that the function is incorrect.
In this example is the last upload value the 62,41 from Date 2016-12-10.
Any solutions?
Since there are multiple values per date, you need to use a timestamp to define the last value.
Create a timestamp value in the script from date and time, or maybe
=FirstSortedValue(DISTINCT B_Wert, -(Datum+Uhrzeit) )
or
=FirstSortedValue(DISTINCT B_Wert, - TimeStamp#(Datum & Uhrzeit,'YYYY-MM-DDhh:mm:ss.fff') )
edit: and you need to either select an ID or use the expression with an ID dimension.
in a Straight table try
FirstSortedValue(B_Wert,-Num(Datum))
or
Max( {<Datum = {"$(=Date(Max(Total <Datenpunkt_ID> Datum)),'YYYY-MM-DD')"}>}B_Wert)
Peek is a scripting function
It depends on where you are putting the Peek function. Try the firstsortedvalue function.
I have more than this one table conected with a SQL server. So I have more Datenpunkt_ID then I show you in the example. I set a filter to Datenpunkt_ID.
i did same scenario using first sorted value
FirstSortedValue(B_Wert,-Datum) you can try this it works
I tried with a simple KPI but it doesn´t work.
Can I use a KPI?
Since there are multiple values per date, you need to use a timestamp to define the last value.
Create a timestamp value in the script from date and time, or maybe
=FirstSortedValue(DISTINCT B_Wert, -(Datum+Uhrzeit) )
or
=FirstSortedValue(DISTINCT B_Wert, - TimeStamp#(Datum & Uhrzeit,'YYYY-MM-DDhh:mm:ss.fff') )
edit: and you need to either select an ID or use the expression with an ID dimension.
have you tried with max?
or with timestamp as Stefan has suggested?
Thank you Stefan
The function works, first I select an ID
=FirstSortedValue(DISTINCT B_Wert, -(Datum+Uhrzeit) )
with the other function it doesn't work
=FirstSortedValue(DISTINCT B_Wert, - TimeStamp#(Datum & Uhrzeit,'YYYY-MM-DDhh:mm:ss.fff') )