Forum Discussion

jpat1234's avatar
jpat1234
New Member
6 years ago

unable to update row data - conditional column

Hi, 

 

I am trying to update conditional column row data based on calculation. below is my sample data. need to display certain catagories data as issue for all entries fort he same id,  if one entry for that has issue. all other logic remains same. 

for below data, id 2005 - has 4 entries - 1 issue , 3 good. need to show all 4 as issue in that case. 

tried several formulas but didn't work. wondering if we can achieve this in powerbi desktop ? this is my first time with it. 

 

date  IDcategoryanswerfollowupskippedCustomgoodFupSkipIssue
5/19/2020200612390000000FalseFalseG1   
5/19/2020200612380000001TRUEFalseFup 1  
5/19/2020200612390000000FalseFalseG1   
5/19/2020200510490000000FalseFalseG1   
5/19/2020200510490000000FalseFalseG1   
5/19/2020200510490000000FalseFalseG1   
5/19/2020200510480000001FalseFalseI   1
5/19/202020055690000000FalseFalseG1   
5/19/202020055690000000FalseFalseG1   
5/19/202020055680000001TrueFalseFup 1  
5/19/20202005280000001TrueFalseFup 1  
5/19/20202005280000001TrueFalseFup 1  

4 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    jpat1234 - So what are we looking at? Is that your expected output? If so, what does the source data look like?

     

    Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

    The most important parts are:
    1. Sample data as text, use the table tool in the editing bar
    2. Expected output from sample data
    3. Explanation in words of how to get from 1. to 2.

    • jpat1234's avatar
      jpat1234
      New Member

      1) for catagory 104 in my table - want to change row level data on issues column

      2) for catagory 104 ,  if one row has issue or follow up then all rows for should be displayed as issue/followup for same id. 

      3) all other data remains the same. 

       

      My data        
       IDcategoryanswerfollowupskippedgoodFupSkipIssue
      200510490000000FalseFalse1   
      200510490000000FalseFalse1   
      200510490000000FalseFalse1   
      200510480000001FalseFalse   1
      20055680000001TrueFalse 1  
      200612380000001FALSEFalse   1
      200612390000000FalseFalse1   
               
      Expected data (want to change the way issue column looks in the data table) 
               
       IDcategoryanswerfollowupskippedgoodFupSkipIssue
               
      200510490000000FalseFalse   1
      200510490000000FalseFalse   1
      200510490000000FalseFalse   1
      200510480000001FalseFalse   1
      20055680000001TrueFalse 1  
      200612380000001FALSEFalse   1
      200612390000000FalseFalse1   
  • mahoneypat's avatar
    mahoneypat
    Microsoft Employee

    Please try this expression in your calculated column.  I called the table 'Issues'.

     

    ThisIDHasIssue =
    VAR issuesthisID =
    CALCULATE (
    COUNTROWS ( Issues ),
    ALLEXCEPT ( Issues, Issues[ ID] ),
    Issues[Issue] = 1
    )
    RETURN
    IF ( issuesthisID >= 1, 1, 0 )

    If this works for you, please mark it as solution.  Kudos are appreciated too.  Please let me know if not.

    Regards,

    Pat

  • v-xicai's avatar
    v-xicai
    Community Support

    Hi jpat1234 ,

     

    You may create measure like DAX below.

     

    CountIssue=

    VAR d= CALCULATE(COUNT(Table1[category]),FILTER(ALLSELECTED(Table1), Table1[ID] =MAX(Table1[ID])))

    RETURN

    IF(COUNTROWS(FILTER(Table1, Table1[ID]=MAX(Table1[ID])&& Table1[Issue] <> BLANK())) >1, d ,0)

     

    Best Regards,

    Amy 

     

    Community Support Team _ Amy

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