Data expression not returning same feature for different elements in Dashboard

246
2
Jump to solution
07-08-2021 09:34 AM
Labels (1)
RickeyFight
MVP Regular Contributor

So I am using a Data Expression for each of these elements within the dashboard.

The expression is:

 

 

var portal = Portal("");
var fs = FeatureSetByPortalItem(
  portal,
  "",
  1,
  [
    "Date_",
    "W_F_MGD",
    "E_F_MGD",
    "TOTAL_W_E_MGD",
    "TID_FLOW_MGD",
    "REEDER_Percent_FULL",
    "TAP_FLOW_MGD",
    "PLANT_PRODUCTION_MGD"
  ],
  false
);

// Find the most recent date from the date field to filter the FeatureSet for the latest record
var maxDate = Text(Date(Max(fs,'Date_')),"YYYY-MM-DD");
return Filter(fs, "Date_ = @maxDate");

 

 

 

I do not know why the Gage has the latest information but the Indicators and pie chart are pulling from a few days ago. 

RickeyFight_0-1625761484730.png

Here is the result when I test the Expression:

RickeyFight_1-1625761954741.png

 

 

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Regular Contributor

Just to check, expand the date format to include the time. Since your timestamp is midnight, odds are it's adjusting the value for your time zone. If you were in UTC+6, then a midnight timestamp would show up as the previous date at 18:00.

You could use ToUTC to return the timestamp in the UTC value to avoid this.

 

Text(Date(ToUTC(Max(fs,'Date_'))),"YYYY-MM-DD")

 

 

- Josh Carlson
Kendall County GIS

View solution in original post

2 Replies
jcarlson
MVP Regular Contributor

Just to check, expand the date format to include the time. Since your timestamp is midnight, odds are it's adjusting the value for your time zone. If you were in UTC+6, then a midnight timestamp would show up as the previous date at 18:00.

You could use ToUTC to return the timestamp in the UTC value to avoid this.

 

Text(Date(ToUTC(Max(fs,'Date_'))),"YYYY-MM-DD")

 

 

- Josh Carlson
Kendall County GIS

View solution in original post

RickeyFight
MVP Regular Contributor

@jcarlson 

Any idea how to use last edit date?  

I was requested to add more dates past the current date. 

 

  [
    "Date_",
    "W_F_MGD",
    "E_F_MGD",
    "TOTAL_W_E_MGD",
    "TID_FLOW_MGD",
    "REEDER_Percent_FULL",
    "TAP_FLOW_MGD",
    "PLANT_PRODUCTION_MGD",
    "last_edited_date"
  ],
  false
);


// Find the most recent date from the date field to filter the FeatureSet for the latest record
var maxDate = Text(Date(ToUTC(Max(fs, 'last_edited_date'))),"YYYY-MM-DD-HH-mm");
return Filter(fs, "last_edited_date = @maxDate");

 

Here is the dashboard issue. I have our draw down past the current date but I cannot find a way to jump back and display the latest data that has been added. I thought last edit date would work but I keep getting no data. 

RickeyFight_0-1626984297983.png

 

0 Kudos