Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Assistance Calculated Table: Change texts on several rows and copy the same texts on unaffected rows

Hi

 

I have this problem.

 

Screenshot 1 shows the details of the only projects I need  changes.

 

Screenshot2 shows the transtype should be changed by Screenshot 3. The original transtype was created from M Code so I used a Dax creating transtype 2 using calculated column

 

 

 

I want to know if it is possible to create another calculated column wherein transtype2 will be captured for the above projects only and the remaining texts will just be copied from transtype.

 

thanks....tksnota

  • Anonymous 

     

    Download example PBIX file with the code shown below

     

    I think this is what you are after, although in your last message you mention a column called Transtype2 when there isn't a column of that name in the images you showed.  But that is easily fixed in this code

     

     

    Column = 
    
    SWITCH(
    
        TRUE(),
    
        [Entry_No] = 0 && [transtype] = "Not In Margin Report (B)" && [transsubtype 2] = "In Margin Report", "Blended",
    
        [Entry_No] <> 0 && [transtype] = "In Margin Report" && ISBLANK([transsubtype 2]), "Blended",
    
        [Entry_No] <> 0 && [transtype] = "Not In Margin Report (P)" && ISBLANK([transsubtype 2]), "Not Blended",
    
        [Entry_No] <> 0 && [transtype] = "Not In Margin Report (V)" && ISBLANK([transsubtype 2]), "Not Blended"
    
    )
    

     

     

    Regards

     

    Phil

     

4 Replies

  • Hi Anonymous 

     

    I don't see the connection between the 3 images, so I do not know what you are trying to achieve.

     

    Please restate the problem and show an example of the result you want.  Also please supply sample data preferably a file so that we don't have to recreate the tables.

     

    Regards

     

    Phil

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi,

       

      Apologies for not being clear.

       

      This is what I want to achieve

       

      Condition 1: Entry No. = 0, Transtype = Text (Not In Margin Report (B), Transtype2 = Text  (In Margin Report)  then make it Blended

      Condition 2: Entry No. <> 0, Transtype = Text (In Margin Report), Transtype2 = Text  (Blank)  then make it Blended

      Condition 3: Entry No. <> 0, Transtype = Text (Not In Margin Report (P), Transtype2 = Text  (Blank)  then make it Not Blended

      Condition 4: Entry No. <> 0, Transtype = Text (Not In Margin Report (V), Transtype2 = Text  (Blank)  then make it Not Blended

       

      All the data from the same table and need calculated column.

       

      Thanks...tksnota

      • PhilipTreacy's avatar
        PhilipTreacy
        Icon for Super User rankSuper User

        Anonymous 

         

        Thanks, I'll try to read that and understand.  But you still haven't provided any data in a format I can use.  Images can't be imported so I have to recreate everything 😞

         

        Phil

  • Anonymous 

     

    Download example PBIX file with the code shown below

     

    I think this is what you are after, although in your last message you mention a column called Transtype2 when there isn't a column of that name in the images you showed.  But that is easily fixed in this code

     

     

    Column = 
    
    SWITCH(
    
        TRUE(),
    
        [Entry_No] = 0 && [transtype] = "Not In Margin Report (B)" && [transsubtype 2] = "In Margin Report", "Blended",
    
        [Entry_No] <> 0 && [transtype] = "In Margin Report" && ISBLANK([transsubtype 2]), "Blended",
    
        [Entry_No] <> 0 && [transtype] = "Not In Margin Report (P)" && ISBLANK([transsubtype 2]), "Not Blended",
    
        [Entry_No] <> 0 && [transtype] = "Not In Margin Report (V)" && ISBLANK([transsubtype 2]), "Not Blended"
    
    )
    

     

     

    Regards

     

    Phil