How to calculate % of total with distinct countif as a metrics

I have a dataset looks like this and it’s here in the [Arena](event_first_attendance_%

dataset:

I want to calculate an aggregate metrics to show the % of events with unique first attendance of participants in Sale and HR department.

I first created a calculated field to rank events for each participant:

This allows me to display events that include participant’s first attendance.

For example, for event2, there are 4 unique participants in total in sale and accounting department, but only f participated the first time, so the count is showing as 1.

I want to create a metrics to show the number of events that include first attendance. In this sample, it should be 2/3=67%.

It shows error of mismatch aggregation. Looking for some help on this!

still looking for some help here

1 Like

Hey @kiko Thank you for posting your question! I have pinged our team to ask them to look at this in the AM.

1 Like

Hi @kiko

Could you please try the following calculations to obtain the desired percentage.

Example:

FirstAttendanceFlag = 
ifelse(
  ({job function} = 'sale' OR {job function} = 'accounting')
  AND rank([date ASC], [Participant], PRE_AGG) = 1,
  1,
  0

EventWithFirstAttendance =
ifelse(FirstAttendanceFlag = 1, Event, NULL)

Distinct Count Event =
distinctCountOver(Event, [], PRE_AGG)

Distinct Count of First Attendance =
distinctCountOver(HasFirstAttendance, [], PRE_AGG)

Percentage =
{Distinct Count of First Attendance} / {Distinct Count Event}






3 Likes

Hi @Xclipse this works, thank you!

For future reference to anyone with similar question: HasFirstAttendance=EventWithFirstAttendance