Forum Discussion

Ge_abe's avatar
Ge_abe
Regular Visitor
5 years ago
Solved

Single value for variation for IF Statement

I am trying to get an IF statement with below:

Compliance = if(Accounts[Next Expected QSR].[Date] <= Today(), "NO", "YES")
 
But I am getting error message "  A single value for variaton 'Date' for column 'Next Expected QSR' in table 'Accounts' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.." .
 
I am not sure if I should add the MIN , MAX, SUM, Count since the Next expected QSR is a date value.
  • Ge_abe , what you trying will work a new column

    Compliance = if(Accounts[Next Expected QSR].[Date] <= Today(), "NO", "YES")

     

    If you need measure you need to try

    Compliance = if(max(Accounts[Next Expected QSR].[Date]) <= Today(), "NO", "YES")

    or

    Compliance = if(maxX(Accounts,Accounts[Next Expected QSR].[Date]) <= Today(), "NO", "YES")

2 Replies

  • Ge_abe , what you trying will work a new column

    Compliance = if(Accounts[Next Expected QSR].[Date] <= Today(), "NO", "YES")

     

    If you need measure you need to try

    Compliance = if(max(Accounts[Next Expected QSR].[Date]) <= Today(), "NO", "YES")

    or

    Compliance = if(maxX(Accounts,Accounts[Next Expected QSR].[Date]) <= Today(), "NO", "YES")

  • camargos88's avatar
    camargos88
    Icon for Community Champion rankCommunity Champion

    Ge_abe ,

     

    Try using:

    Compliance = IF(SELECTEDVALUE(Accounts[Next Expected QSR].[Date]) <= Today(), "NO", "YES")

     

    Measures need a scalar return, so you need to nest it in a scalar function.