Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello!
I have data that shows employee_key, employee_name, employee_id, emp_status and country.
An employee can have multiple emp_status. My expression in the text box is below:
=Num(Sum({1} Aggr(Sum({$<EMPLOYEE_NAME,COUNTRY=p(COUNTRY)>} CALLS)/
Count({$<EMPLOYEE_NAME=,COUNTRY=p(COUNTRY)>} Aggr(If(Sum({$<EMPLOYEE_NAME=,COUNTRY=p(COUNTRY)>} CALLS) > 0, 1), DATE, EMPLOYEE_NAME=)), DATE)),'#,##0')
Right now, it's picking whatever is the 1st record for that employee which doesn't tie up to any country so the output it gives is 0.
EMP_KEY, EMP_NAME, EMP_ID, EMP_STATUS, COUNTRY
123 JOE 12001 WITHDRAWN -
123 JOE 12001 WITHDRAWN -
234 JOE 12010 ACTIVE US
What's the right expression to only display country from the active record?
Thanks in advance for your help!
Using the Only() function will return a value, either it be a literal string or a number. If you need to further format it, you can use functions like Text() or Date#(), or etc. If Only() returns more than one value, then you need to use a Max() or Rank(), or FirstSortedValue() or Aggr() function to make sure you are returning one single value. But again, regardless the type of value, you can represent text in a text object using those functions.
Some examples:
Find out min and max Dates and show a value only from this row
What's the aggr dimension value for the highest value of expression
and eventually Displaying the Top Salesperson in a Textbox
Still gives me 0.
Without the red part you are getting what you want? Just by adding EMP_STATUS={'ACTIVE'} the output becomes 0?
Is there a way to do the filter in the DataModel? If so, can you please let me know?
Thank you all for your kind assistance.
You are only looking to load data where EMP_STATUS = ACTIVE? If that's true, then load with where statement
LOAD .....
FROM ....
Where EMP_STATUS = 'ACTIVE';
I tired it with and without the red part, the result is 0
So your original expression isn't working then?
I only need to pull the Country data for record that is "ACTIVE" if there are multiple records for that employee.
The above expression will filter for just the "ACTIVE" for all the records of employees.
Yes, it will pull all those rows where EMP_STATUS = ACTIVE
Actually, I need to pull all the records of the employees may it be withdrawn or active at the DataModel level. But in the UI, that's where I'm having the challenge of filtering the record based on the employee's active record given the above expression. The expression is pulling the withdrawn record. Even with the set analysis of EMP_STATUS={'ACTIVE'}, it's still not giving the desired result.