Forum Discussion
Averages in Feet and Inches
- 4 years ago
Hi Anonymous
In Power Query, you can extract the feet and inches components of that text column using Extract feature under Add Column tab.For Feet, that is Text Before Delimter where your delimeter is ' and for inches that is Text Between Delimeters where the first delimeter is a space and the second delimter is ". You will then need to change the data type of these newly created columns to numbers.
Alternatively you can use DAX to extract a string and convert them to numbers. Here are sample formulas.Foot = VAR _singlequote = FIND ( "'", 'Table'[Column] ) - 1 RETURN VALUE ( LEFT ( 'Table'[Column], _singlequote ) ) Inch = VAR _singlequote = FIND ( " ", 'Table'[Column] ) + 1 VAR _doublequote = FIND ( """", 'Table'[Column] ) VAR __lenght = _doublequote - _singlequote RETURN VALUE ( MID ( 'Table'[Column], _singlequote, __lenght ) )Here's a sample pbix for your reference: https://drive.google.com/file/d/1xoHmnqO8ieKHCkPb_lcEg2AwKQj0hiCg/view?usp=sharing
You can then use these new columns in your aggregation (sum, average, etc)
Hi Anonymous
In Power Query, you can extract the feet and inches components of that text column using Extract feature under Add Column tab.
For Feet, that is Text Before Delimter where your delimeter is ' and for inches that is Text Between Delimeters where the first delimeter is a space and the second delimter is ". You will then need to change the data type of these newly created columns to numbers.
Alternatively you can use DAX to extract a string and convert them to numbers. Here are sample formulas.
Foot =
VAR _singlequote =
FIND ( "'", 'Table'[Column] ) - 1
RETURN
VALUE ( LEFT ( 'Table'[Column], _singlequote ) )
Inch =
VAR _singlequote =
FIND ( " ", 'Table'[Column] ) + 1
VAR _doublequote =
FIND ( """", 'Table'[Column] )
VAR __lenght = _doublequote - _singlequote
RETURN
VALUE ( MID ( 'Table'[Column], _singlequote, __lenght ) )
Here's a sample pbix for your reference: https://drive.google.com/file/d/1xoHmnqO8ieKHCkPb_lcEg2AwKQj0hiCg/view?usp=sharing
You can then use these new columns in your aggregation (sum, average, etc)