Forum Discussion
Calculate a simple percentage
- 5 years ago
Hi Tybaal
Download sample PBIX with solution
SELECTEDVALUE gets the value on each row, try this
% Paid = SELECTEDVALUE( 'Table'[Price Paid] ) / SELECTEDVALUE ( 'Table'[Price] )Or to avoid divide by zero problems, this will also work
% Paid = DIVIDE( SELECTEDVALUE( 'Table'[Price Paid] ) , SELECTEDVALUE ( 'Table'[Price] ) )Regards
Phil
- Anonymous5 years ago
HI Tybaal,
If you are work with measure expression, aggregate functions can be used to extract the current value.
But when you work with calculated columns, if you not add any filter on these aggregate expressions they will summary whole column values instead of calculating on the current field value.I'd like to suggest you create calculated columns without aggregate function or create measure formulas that similar to 'PhilipTreacy' shared.
% Paid = 'Table'[Price Paid] / 'Table'[Price]Regards,
Xiaoxin Sheng
Hi Tybaal
Download sample PBIX with solution
SELECTEDVALUE gets the value on each row, try this
% Paid = SELECTEDVALUE( 'Table'[Price Paid] ) / SELECTEDVALUE ( 'Table'[Price] )
Or to avoid divide by zero problems, this will also work
% Paid = DIVIDE( SELECTEDVALUE( 'Table'[Price Paid] ) , SELECTEDVALUE ( 'Table'[Price] ) )
Regards
Phil