Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

How to create new GROUP field ?

Hi All   My PBI FILE :- https://www.dropbox.com/s/vsas6b4276pbwq4/GROUP%20V001.pbix?dl=0   Mt expected result shown in yellow :-  
  • v-yingjl's avatar
    v-yingjl
    5 years ago

    Hi Anonymous ,

    Try to create the new column like this:

    New Column_ =
    IF (
        "G" & CONVERT ( [G_TYPE], STRING ) = [SAL_C]
            || [SAL_C] = BLANK (),
        "G" & CONVERT ( [G_TYPE], STRING ),
        [SAL_C]
    )
    

    Attached the modified sample file in the below, hopes to help you.

     

    Best Regards,
    Community Support Team _ Yingjie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • mussaenda's avatar
    mussaenda
    5 years ago

    you can create a new column in Power Query to meet your conditions.

     

    if [YOUR GTYPE COLUMN] = null
    or [YOUR GTYPE COLUMN] = ""
    and ([YOUR SAL_C COLUMN] = null
    or [YOUR SAL_C COLUMN] = "")
    then null
    else 
    
    if [YOUR GTYPE COLUMN] = null
    or [YOUR GTYPE COLUMN] = ""
    and ([YOUR SAL_C COLUMN] <> null
    or [YOUR SAL_C COLUMN] <> "")
    then [YOUR SAL_C COLUMN]
    else 
    
    if [YOUR SAL_C COLUMN] = null
    or [YOUR SAL_C COLUMN] = ""
    then "G" & Number.ToText([YOUR GTYPE COLUMN])
    else 
    [YOUR SAL_C COLUMN]