Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
ThomasWeppler
Skilled Sharer
Skilled Sharer

How do remove a specific number of digits based on the number of digits in a different column

question nr..png

I have two colums one with a nr. of the question form and one with the questionform and questionnumber right after in the same colum, but I only need question nr.

Is their a good measure I can us for that.
I tried 

questionnr = RIGHT(Questionanswer[questionAnswersId],3), but if answerid or questionnr get more digits it starts to add new problems.
1 ACCEPTED SOLUTION
smpa01
Super User
Super User

@ThomasWeppler  you can do this, pbix is atatched

 

 

Column = 
VAR _leftLength = LEN(VALUE('Table'[Column1]))
VAR _rightLength = LEN(VALUE('Table'[Column2]))
VAR _lenthToExtract = _leftLength-_rightLength
VAR _value = MID(VALUE('Table'[Column2]),_leftLength+1,_rightLength)
RETURN _value

 

 

smpa01_0-1635171713677.png

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

View solution in original post

3 REPLIES 3
vivran22
Community Champion
Community Champion

@ThomasWeppler 

 

Considering they are number columns, you may also try the following:

 

Extract Num =
VAR _Sub = 'Test Table'[Col1] * 10^(LEN('Test Table'[Col2]) - LEN('Test Table'[Col1]))
VAR _Diff = 'Test Table'[Col2] - _Sub
RETURN
_Diff
 
vivran22_0-1635172006250.png

 

Cheers!
Vivek

If it helps, please mark it as a solution
Kudos would be a cherry on the top 🙂 (Hit the thumbs up button!)
If it doesn't, then please share a sample data along with the expected results (preferably an excel file and not an image)


https://www.vivran.in/

Connect on LinkedIn

jdbuchanan71
Super User
Super User

@ThomasWeppler 

Give this a try.

questionnr =
RIGHT (
    Questionanswer[questionAnswersId],
    LEN ( Questionanswer[questionAnswersId] ) - LEN ( Questionanswer[AnswerID] )
)
smpa01
Super User
Super User

@ThomasWeppler  you can do this, pbix is atatched

 

 

Column = 
VAR _leftLength = LEN(VALUE('Table'[Column1]))
VAR _rightLength = LEN(VALUE('Table'[Column2]))
VAR _lenthToExtract = _leftLength-_rightLength
VAR _value = MID(VALUE('Table'[Column2]),_leftLength+1,_rightLength)
RETURN _value

 

 

smpa01_0-1635171713677.png

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.