Forum Discussion

Rajkumar07's avatar
Rajkumar07
Icon for Helper I rankHelper I
4 years ago

Want to replace 0 wherever there is no data while creating a calculated column

Hi Team,

Test Users who view or edit =
  var x = IF('FILE_ACTIVITY_F'[ID_Tool] = 2 &&
'FILE_ACTIVITY_F'[N_ViewedOrEditedFileCount] >0,1,0)
return
IF(ISBLANK(x),0,x)

I've tried using the above formula but i'm unable to get the exact result.


Let me know if there any other alternateway to achive 0 for blank or no data.




10 Replies

  • MahyarTF's avatar
    MahyarTF
    Icon for Memorable Member rankMemorable Member

    Hi,

    What is the datatype for [ID_Tool] and [N_ViewedOrEditedFileCount] and also are the column or measure ?

    would you please share the sample data for the empty line here ?

     

    • Rajkumar07's avatar
      Rajkumar07
      Icon for Helper I rankHelper I

      Hi,

       

      [ID_Tool] and [N_ViewedOrEditedFileCount] both columns are whole number.

      I've created a calculated column with the help of if condition to achive the kpi condition.
      Is there a way to replace 0 if there is no data?

       

      • MahyarTF's avatar
        MahyarTF
        Icon for Memorable Member rankMemorable Member

        Hi Rajkumar07 ,

        As the columns are the number type it should work.

        Would you please create the table visual that is included the [ID_Tool], [N_ViewedOrEditedFileCount], and [Test Users who view or edit] fields to clarify the records with null value for the particular column

  • v-zhangti's avatar
    v-zhangti
    Icon for Community Support rankCommunity Support

    Hi, Rajkumar07 

     

    I have no problem testing with your formula.

    What are the difficulties you are experiencing?

     

    Best Regards,

    Community Support Team _Charlotte

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

    • Rajkumar07's avatar
      Rajkumar07
      Icon for Helper I rankHelper I

      Hi Team,

       

      Could you please confirm the above tested function its a measure or calculated column?

      When i'm trying to created a calculated column with the above formula I'm unable to get the expected result.
      The reason "IF" condition it's checked everything in the firstline it self. Then it will not come and check in the return function. This is my understanding.


      • v-zhangti's avatar
        v-zhangti
        Icon for Community Support rankCommunity Support

        Hi, Rajkumar07 

         

        My test is a calculated column. Can you provide sample data for [ID_Tool] and [N_ViewedOrEditedFileCount]?

         

        Best Regards

    • Rajkumar07's avatar
      Rajkumar07
      Icon for Helper I rankHelper I

      Hi Team,

      Thank  for your quick response,

      I would like you inform you this, this how i'm having the data set and the sample data is given below


      Wherever there is no data for the period I want to replace with 0.

      Is that possible to get the result. Please advice.