Forum Discussion

karladizmal's avatar
karladizmal
New Member
2 years ago
Solved

Expressions that yield variant data-type cannot be used to define calculated columns.

Hi All!

Very new at PBI. 

I am trying to make a matchkey in the table view with a concatenate, but I get the subject message error. 

 

Here's the expression:

Matchkey = IF(AND('wo duplicates'[QuotedMfr] <> BLANK(), 'wo duplicates'[QuotedPart] <> BLANK()),'wo duplicates'[QuotedMfr] && 'wo duplicates'[QuotedPart], "")
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi,karladizmal 

    Regarding the issue you raised, my solution is as follows:

    1.First I have created the following table and the column names and data are the data you have given:

     

    We've reproduced your code, and we've got the following result.

    2.We believe that the reason for this result is that you determine whether both columns are empty and then determine whether two columns of values exist, and the end result is a Boolean value.

    So we can change the False result of the If() function to either the False() function or the Blank().

    Matchkey =
    IF (
        AND (
            'wo duplicates'[QuotedMfr] <> BLANK (),
            'wo duplicates'[QuotedPart] <> BLANK ()
        ),
        'wo duplicates'[QuotedMfr] && 'wo duplicates'[QuotedPart],
        BLANK ()
    )
    

    3.I'm guessing you might need the following calculated columns:

    merge =
    IF (
        AND (
            'wo duplicates'[QuotedMfr] <> BLANK (),
            'wo duplicates'[QuotedPart] <> BLANK ()
        ),
        'wo duplicates'[QuotedMfr] & " " & 'wo duplicates'[QuotedPart],
        "0"
    )

     

    4.Here's my final result, which I hope meets your requirements.

    Can you share sample data and sample output in tabular format if I am misunderstanding? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

     

    Please find the attached pbix relevant to the case.

     

    Best Regards,

    Leroy Lu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.


     

  • Hi,

    Try this

    Matchkey = IF(AND('wo duplicates'[QuotedMfr] <> BLANK(), 'wo duplicates'[QuotedPart] <> BLANK()),'wo duplicates'[QuotedMfr] & 'wo duplicates'[QuotedPart], blank())

3 Replies

  • Hi,

    Try this

    Matchkey = IF(AND('wo duplicates'[QuotedMfr] <> BLANK(), 'wo duplicates'[QuotedPart] <> BLANK()),'wo duplicates'[QuotedMfr] & 'wo duplicates'[QuotedPart], blank())
    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi,karladizmal 

      Regarding the issue you raised, my solution is as follows:

      1.First I have created the following table and the column names and data are the data you have given:

       

      We've reproduced your code, and we've got the following result.

      2.We believe that the reason for this result is that you determine whether both columns are empty and then determine whether two columns of values exist, and the end result is a Boolean value.

      So we can change the False result of the If() function to either the False() function or the Blank().

      Matchkey =
      IF (
          AND (
              'wo duplicates'[QuotedMfr] <> BLANK (),
              'wo duplicates'[QuotedPart] <> BLANK ()
          ),
          'wo duplicates'[QuotedMfr] && 'wo duplicates'[QuotedPart],
          BLANK ()
      )
      

      3.I'm guessing you might need the following calculated columns:

      merge =
      IF (
          AND (
              'wo duplicates'[QuotedMfr] <> BLANK (),
              'wo duplicates'[QuotedPart] <> BLANK ()
          ),
          'wo duplicates'[QuotedMfr] & " " & 'wo duplicates'[QuotedPart],
          "0"
      )

       

      4.Here's my final result, which I hope meets your requirements.

      Can you share sample data and sample output in tabular format if I am misunderstanding? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

       

      Please find the attached pbix relevant to the case.

       

      Best Regards,

      Leroy Lu

      If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.