Forum Discussion

poojithas's avatar
poojithas
Icon for Helper III rankHelper III
3 years ago
Solved

Calculated column in Power BI

Hi All,

I have a table as below: An account_no could have either two values Record_Set and Non-Unique/In-Complete or only have one value that is Record_Set.

 

Scenario 1 - Table

 

I need to create a new column with condition as if account_no has both the values then show as  "Non-Unique" and if account_no has only one value that it should be "Unique"

 

Expected output

Account_noUnique/Non-Unique (New column)
0100152603Non-Unique
0100152131 Non-Unique
0100177639 Non-Unique
010078057Unique
  

 

Scenario2 - Table:

I need to create a new column with condition as if account_no has both the values then show as  "In-Complete" and if account_no has only one value that it should be "Complete" for each category. 

This should work dynamically when the category filter is applied

 

Expected output

Account_noUnique/Non-Unique (New column)
0100156233Complete
0100156277 In-Complete
0100156398In-Complete
0100157124Complete
0100161293In-complete

Could somone please let me know how to achieve the above case.

Thank you

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi poojithas ,

     

    As shown below are my calculations of the expected results for each of the three tables you want.

    You can refer to my pbix file for better understanding.

     

    Best regards,

    Community Support Team Selina zhu

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

     

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi poojithas ,

     

    Like this?

    This is for your senior 1, just create one measure and a calculated column to meet your needs. As the following writes:

    rows = CALCULATE(COUNTROWS('Table'),FILTER(ALL('Table'),'Table'[Account No.]=SELECTEDVALUE('Table'[Account No.])))
    new Column = IF([rows]=1,"Unique","non-unique")

    For senior2, the solution process is similar to 1, just change the filter condition.

    You can refer to my pbix file for better understanding.

     

    Best regards,

    Community Support Team Selina zhu

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

    • poojithas's avatar
      poojithas
      Icon for Helper III rankHelper III

      Anonymous  I have replicated the same steps but for few of the account_nos, it shows a different value.
      eg:

      The expected output for the highlighted account_no is complete as it has only one value"record_set"

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi poojithas ,

         

        What is the final desired result you want to present?

         

        Best regards,

        Community Support Team Selina zhu

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