Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
tsoares05
Frequent Visitor

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 calculation on "Income % versions", displaying the percentage of income from each product version.

In this example I've calculated the value manually on Excel, just to show what I'm searching for.

 

Calculated column.JPG

I've tried a few formulas, but I don't know how to create this. Is this achievable?

Any help is more than welcome.

Thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

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 )

vbinbinyumsft_1-1687317033365.png

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.

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

This should be solved with a measure - not with a calculated column.  If my approach suits you, then share data in a fomat that can be pasted in an MS Excel file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

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 )

vbinbinyumsft_1-1687317033365.png

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.

Thanks @Anonymous ! Solved my goal.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.