
Hi,
I have a dataset in which I have the data set up in the following way:
This data is currently residing within the Dataverse and I would like to set up either a Data table or Gallery to pull from here and show the latest records for each eventID, along with all the attributes listed. So rather than just the eventID and the max eventCreatedTime for the eventID, I also want to know the additional attributes (eventMetric, eventAdjustedAmount) for those records, which in the example above is not limited to one row, but can be multiple rows (2,3,4,etc).
I have found some solutions online through this forum but most seem to only produce one row per group, whereas I would like to grab multiple by group (if multiple records exist for that group and that max eventCreatedTime). Please let me know if you have any thoughts. I appreciate your help.
I tried the following code which resulted it one row per eventID
ForAll(
GroupBy(eventDetails,
"cr2cc_eventID, "_records"
),
With({_top: First(Sort(_records, eventCreatedTime, Descending))},
{eventID: cr2cc_eventID,
dateCreated: _top.eventCreatedTime,
eventAdjustedAmount: _top.eventAdjustedAmount,
eventMetric: _top.eventMetricOrValue
}
)
)
Use a gallery and subgallery to display your results. For the Items property of the main gallery : GroupBy(eventDetails,"cr2cc_eventID, "_records")
In the Item property of the SubGallery: Sort(ThisItem._records, eventCreatedTime, Descending)
Place labels inside the subgallery for ThisItem.eventCreatedTime, ThisItem.eventMetric, ThisItem.eventAdjustedAmount.
You could even put a label in the main gallery and use Sum(ThisItem.DATA,ThisItem.eventAdjustedAmount) to get aggregate functions on the data in the subgallery or obtain the latest information by placing a label in the main gallery: First(Sort(ThisItem.eventCreatedTime,Descending)).eventMetric