Forum Discussion

desarrolloaudit's avatar
desarrolloaudit
New Member
6 years ago
Solved

Replacing (blank) with 0

I am trying to replace the value (Blank) in a number card with 0, but when performing the formula I get this error (Expressions that yield variant data-type cannot be used to define calculated columns.) How can I fix it?

 

The formula is: 

Column = IF(ISBLANK('Formato medidas de prevencion'[Medida de prevención implementada]),0,'Formato medidas de prevencion'[Medida de prevención implementada])
  • parry2k's avatar
    parry2k
    6 years ago

    desarrolloaudit you have to simply add a measure like this and use this on each card as you are filtering each card

     

    Count = COUNTROWS ( Table) + 0

     

    Use above measure in each card.

     

     

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

    Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

9 Replies

  • desarrolloaudit you can simply do +0

     

    Measure = SUM ( Tabe[Amount] ) + 0

     

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

    Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

    • desarrolloaudit's avatar
      desarrolloaudit
      New Member

      parry2k 

      What happens is that the values of that column are text, and the card only counts how many times that value appears in the column

  • Hi desarrolloaudit ,

     

    You can do this very easily with Power Query Editor(PQE) in following steps:

    Open PQE -> Right-Click on the column name -> Replace Values -> Keep value to Find blank and type 0 in Replace with field -> OK 

     

    Give a thumbs up if this post helped you in any way and mark this post as solution if it solved your query !!!

      • parry2k's avatar
        parry2k
        Super User

        desarrolloaudit you have to simply add a measure like this and use this on each card as you are filtering each card

         

        Count = COUNTROWS ( Table) + 0

         

        Use above measure in each card.

         

         

        I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

        Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.