Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Error Expression.Error: We cannot convert the value false to type Function."

Hello to All,

I am having a problem with a code to return a value based in multiple criteria, comparing multiple columns in two different tables.

I have the error message after I run the code.

Error Expression.Error: We cannot convert the value false to type Function."

let
relevantT = Table.SelectRows(Scores, each (Scores[AgeCategory]=FtJump[AgeCategory] and Scores[Position] = FtJump[ScorePosition] and Scores[Gender] = FtJump[#"Gender:"] and Scores[Protocol]= FtJump[JumpProtocol])),

valueat100 = List.MinN(Table.SelectRows(relevantT,Scores[ScorePercent] = 100),Scores[ScoreValue]),

valueat5 =  List.MinN(Table.SelectRows(relevantT,Scores[ScorePercent] = 5),Scores[ScoreValue]),

orderIsdescending = valueat100 > valueat5,

percentil = if orderIsdescending
then List.MaxN( Table.SelectRows(relevantT, FtJump[JumpProtocol] >= Scores[ScoreValue]),Scores[ScorePercent])
else List.MinN( Table.SelectRows(relevantT, FtJump[JumpProtocol] >= Scores[ScoreValue]),Scores[ScorePercent]),
result = percentil
in
result



If please anyone can help me to check where is the error?
Thanks a lot.

10 Replies

  • camargos88's avatar
    camargos88
    Community Champion

    Hi Anonymous ,

     

    Try changing this:

     

    Table.SelectRows(relevantT, FtJump[JumpProtocol] >= Scores[ScoreValue])

     

    by:

     

    Table.SelectRows(relevantT, each FtJump[JumpProtocol] >= Scores[ScoreValue])

     

     

    Insert the each keyword in every Table.SelectRows function.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Many Thanks camargos88 

      I just insert the EACH in all the Table.SelectRows functions.

      But now the error has changed.

      Expression.Error: We cannot convert a value of type Table to type List.

      Why is that?

      • camargos88's avatar
        camargos88
        Community Champion

        Hi Anonymous ,

         

        Can you share a sample of your pbix ? So I can take a closer look.