Values are Different with Filter Vs Measure

Hi below is my data

  1. I am calculating " Average attendance over the last 30 days " using formula
    avg(
    coalesce( ifelse( Date >=
    addDateTime(-30,‘DD’,now()),
    Attendence,
    NULL),
    0)
    ) — getting value – 83%


    xech.png)

  2. Using Filter condition in the Visual itself – getting 97%

Is my calculation is wrong?

Hi @Venkat.Metadata, I think your first approach is calculating the average of all the aggregated records, even including the records older than 30 days as “zero”, thus making the result smaller compared to the second approach.

1 Like

@ytakahr , is 2nd approach is correct?.

What is the correct formula for the 1st approach?

@Venkat.Metadata Yes, your second approach looks correct, but please verify with your actual data as well.

You can use the following calculated field for your first approach.

avgIf(Attendence, Date >= addDateTime(-30, 'DD', now()))
1 Like