Forum Discussion

tsoares05's avatar
tsoares05
Frequent Visitor
3 years ago
Solved

Create a calculated column based on conditions

Hi, I'm trying to create a calculated column based on the example below. Basically, the rows that have a 'blank' version are the total income from each product. What I'm trying to achieve is the ca...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi tsoares05 ,

    Please try to create a new column with below dax formula:

    Income % versions =
    VAR cur_pt = [Product]
    VAR _a =
        CALCULATE (
            MAX ( [Income] ),
            FILTER ( 'Table' , [Product] = cur_pt && [Version] = BLANK () )
        )
    VAR _b = [Income]
    VAR cur_ver = [Version]
    VAR _val =
        FORMAT ( DIVIDE ( _b, _a ), "Percent" )
    RETURN
        IF ( cur_ver = BLANK (), BLANK (), _val )
    

    Please refer the attached .pbix file.

     

    Best regards,
    Community Support Team_Binbin Yu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.