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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
ThomasWeppler
Impactful Individual
Impactful Individual

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors