Forum Discussion

Jake_Raz's avatar
01-15-2025
Solved

MIN function refuses to calculate when each parameter is a formula rather than a single field?

Hello! I have the following formula that I keep on getting an error message on, and I'm not sure why: MIN( DDIFF([Days in Invoice Billing End Date],[Days in Invoice Line Item Service Date]), D...
  • HamzaJ's avatar
    01-16-2025

    Hey Jake_Raz ,l

    The min-function does not work like that. You can only offer it 1 measurement. You could use an group by aggregation, however this means you need to add a dimension (or atleast not a calculation of a field). Like min(days by date, DDIFF([Days in Invoice Billing End Date],[Days in Invoice Line Item Service Date])) will generate the minimum found value for that date.

    If you want to achieve what you are looking for you will need to use a CASE-function. So something like;

    CASE
    when MIN(DDIFF([Days in Invoice Billing End Date],[Days in Invoice Line Item Service Date])) <
    MIN(DDIFF([Days in Invoice Line Item Service Date],[Days in Invoice Billing Start Date])) then MIN(DDIFF([Days in Invoice Billing End Date],[Days in Invoice Line Item Service Date]))
    else MIN(DDIFF([Days in Invoice Line Item Service Date],[Days in Invoice Billing Start Date]))
    end

    Hamza