Forum Discussion
Calculate percentage %
Hello PowerBI Community 😁
I'm new with PowerBI, query, & Stuffs. & I need help with something.
So, i want to calculate this column, into percentage %
The logic is, i want to divide every result with /20 and change it to percentage %, but i dont want to calculate "none" result.
for example: if the result is "20" it's should be "100%"
I've tried this, made a new measurement, but it's not work for me.
*Info
Before i make the safety column, i've to define every result & adding new column with this,
Should i convert this column first into interger or something? then i can make a new measurement from it?
Any help will be appreciated 🙏
Hi Anonymous :
Create a column as below:
column = var _convert=IF('Table'[Safety(20)]="None",0,'Table'[Safety(20)]) Return DIVIDE(CONVERT(_convert,INTEGER),20)And you will see:
See attached for the related .pbix file.
Best Regards,
KellyDid I answer your question? Mark my post as a solution!
9 Replies
- vanessafvg
Community Champion
you will need to convert it into an integer if you want to do calculations on it, or a number data type, it cannot work with mixed types in a calculation, consider duplicating the column and changing none to 0 if that fits in with your logi- AnonymousNot applicable
I've changed the "None" with 0 and changed the type into "whole Number"
Then, when i get back to my new measurement its still give me this error
how do i fix this?
- AnonymousNot applicable
Hi Anonymous ,
Staff KRa - Safety2 = IF(MAX('Productivity and Task Organization[Staff KRA - Safety New]) = 0, BLANK(), DIVIDE(MAX('Productivity and Task Organization[Staff KRA - Safety New]), 20)
Regards,
Harsh Nathani
- amitchandak
Super User
Anonymous , in power query, replace None with blank and then convert the data type to whole number or decimal.
That is there on right click of table
- AnonymousNot applicable
Hi Anonymous ,
IF [Safety] is a measure
New Measure =
IF (MAX('Table[Safety]) = "None", BLANK(), CONVERT(MAX(Table[Safety]),INTEGER)If [Safety] is a Column
New Column = IF ('Table[Safety] = "None", BLANK(), CONVERT(Table[Safety],INTEGER)
Then change the formatting to Percentage from the top ribbon.
Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)