Forum Discussion

ph's avatar
ph
Helper I
7 years ago
Solved

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 is unavailable)

 

Any idea how to do it?

 

thx a lot !

  • ph's avatar
    ph
    7 years ago

    Hi Mariusz 

     

    I would like get something like this

     

    Batch No.LEFT(Batch No.;3)
    123123123
    123456123
    123789123
    987987987
    987654987
    987321987

     

    But I cannot solve it as 'new column', where it is easy to set up

  • 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 Repczynski

     

  • Anonymous's avatar
    Anonymous
    7 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.

6 Replies

  • Mariusz's avatar
    Mariusz
    Community Champion

    Hi ph 

     

    Can you provide a data sampe?

     

     

    Best Regards,
    Mariusz

    Please feel free to connect with me.
    Mariusz Repczynski

     

    • ph's avatar
      ph
      Helper I

      Hi Mariusz 

       

      I would like get something like this

       

      Batch No.LEFT(Batch No.;3)
      123123123
      123456123
      123789123
      987987987
      987654987
      987321987

       

      But I cannot solve it as 'new column', where it is easy to set up

      • Mariusz's avatar
        Mariusz
        Community 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 Repczynski