

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Set Analysis with FirstSortedValue
In this application I wanna show for each Principal and Subcategory, which is my last Visit and the avg of the values of this visit.
The problem is that my expression is not working properly.
In Box 1: Last Visit is the calculation that is not working.
VISIT calculation is showing correctly, but Last Visit is calculating the average for all Visits, and should calculate only the AVG for the Visit that appears on the table. On this example should be 0.
Last Visit 2 is supppose to be the same calculation with the first $ in the right place, but is doesn´t work showing this null value.
Box 2 is only a simple AVG calculation. I expect to see 3 lines, one for each VISIT (SCREENING, DAY 1/RCP, DAY 85/RCP), but is only showing for SCREENING cause the others are 0. I tried to show all values but shows me a lot of null lines and I don´t know why.
Box 3 is the complete data
Anyone can explain me how to fix this Last Visit Calculation?
Mine is avg(${<VISIT={$(=FirstSortedValue(DISTINCT VISIT,-Date))}>} Value)
- « Previous Replies
-
- 1
- 2
- Next Replies »
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try this:
Avg(Aggr(If(FirstSortedValue(TOTAL <Principal, QSSCAT> DISTINCT VISIT, -Date) = VISIT, Avg(Value)), Principal, QSSCAT, VISIT))


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your Date field is a Text, can't use FirstSortedValue with that, can you post the excel workbook as well
If a post helps to resolve your issue, please accept it as a Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May be try this..
Avg({<VISIT = {"$(=FirstSortedValue(DISTINCT VISIT,-Date))"}>}Value)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Box 2
Go to presentation tab and untick suppress zero values


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I changed to date and nothing works now. It should work with date or only number?


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
remove the DISTINCT Keyword , i haven't tested this though
If a post helps to resolve your issue, please accept it as a Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May be like attached?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1st Box's expression needs single quotes
Avg({$<VISIT={'$(=FirstSortedValue(DISTINCT VISIT,-Date))'}>} Value)
2nd Box's expression
Avg(Value)+Avg(0.00000000000000000000000001)
and change the number tab to show up until 8 decimals


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This Also Works
VISIT =MaxString({<Date = {'$(=MIN(Date))'}>} VISIT)
Max({<Date = {'$(=MIN(Date))'}>} Value)
MaxString({<Date = {'$(=MIN(Date))'}>} Date)
AVG({<Date = {'$(=MIN(Date))'}>} Value)
If a post helps to resolve your issue, please accept it as a Solution.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry but it is not working correct for all cases. See again the image.
Box 1, first line. 250 is the average for All visits in Ambulation, and should be the average for only Visit DAY 85/RCP, that is 407.5
Application attached again

- « Previous Replies
-
- 1
- 2
- Next Replies »