Forum Discussion
ph
7 years agoHelper I
function LEFT as measure
Hi, I need to use LEFT() function for each row in table so as a measure in 'row context'. Because my report is based on powerBI dataset, I am unable to use LEFT() as a new column (this operation ...
- Anonymous7 years ago
[First 3 Chars for Batch No.] = -- measure var __oneBatchVisible = HASONEFILTER( T[Batch No.] ) var __chars = if ( __oneBatchVisible, var __currentBatch = VALUES( T[Batch No.] ) var __first3Chars = left( __currentBatch, 3 ) return __first3Chars ) RETURN __chars
Best
D.
Mariusz
7 years agoCommunity Champion
Hi ph
Please see the below
Measure = LEFT( MAX( 'Table'[Batch No.] ), 3 )
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.
Anonymous
7 years agoNot applicable
The measure proposed by Mariusz is not too informative when there is more than 1 Batch No. in scope. The usefulness of it is hampered by the fact that when no Bach No. has been explicitly selected, it'll still return... something. What is this something? Well, it's the first 3 letters from the Batch No. that is the max number out of the visible numbers in the current context. Not sure if this is of any use.
Measures should be defined in such a way that they make sense when they are displayed and when it makes no sense for them to appear, they just return BLANK.
Best
Darek
Measures should be defined in such a way that they make sense when they are displayed and when it makes no sense for them to appear, they just return BLANK.
Best
Darek