Forum Discussion
SanderB
7 years agoFrequent Visitor
Avererage in column with variant data type
Hi all, I am stuck in the matrix table in PowerBI. See data below. Column VALUE is formatted as numbers, TEXT as text and U_RPT_VALUE also as text. TEST_NUMBER NAME VALUE TEXT U_RPT_VALUE ...
- 7 years ago
Hi SanderB
Try the below
Measure = VAR _text = SELECTEDVALUE( 'Table'[U_RPT_VALUE] ) VAR _search = SEARCH( "<", _text, 1, 0 ) > 0 RETURN IF( _search, _text, AVERAGE( 'Table'[VALUE] ) )
Best Regards,
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.
Mariusz
Community Champion
7 years agoHi SanderB
Try the below
Measure = VAR _text = SELECTEDVALUE( 'Table'[U_RPT_VALUE] ) VAR _search = SEARCH( "<", _text, 1, 0 ) > 0 RETURN IF( _search, _text, AVERAGE( 'Table'[VALUE] ) )
Best Regards,
Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.

Mariusz
If this post helps, then please consider Accepting it as the solution.
Please feel free to connect with me.
SanderB
7 years agoFrequent Visitor
Hi Mariusz ,
Only one small question about AVERAGE.
Is it possible to have the decimal places dynamic?
I thought that the FIXED function will do this, but this does not work.
Measure = VAR _text = SELECTEDVALUE( RESULT[Merged] ) VAR _search = SEARCH( "<", _text, 1, 0 ) > 0 RETURN IF( _search, _text, FIXED(AVERAGE(RESULT[VALUE]),(RESULT[PLACES]),1))
Thanks,
Sander
- Mariusz7 years ago
Community Champion
HI SanderB
You need some form of aggregation around RESULT[PLACES], try MIN or MAX like below.
Measure = VAR _text = SELECTEDVALUE( RESULT[Merged] ) VAR _search = SEARCH( "<", _text, 1, 0 ) > 0 RETURN IF( _search, _text, FIXED( AVERAGE( RESULT[VALUE] ), MAX( RESULT[PLACES] ), 1 ) )