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
marrasate
Regular Visitor

Get all values between 2 strings

Hi,

 

I'm trying to get all values between two string values. For example, from 1A00000 to 2Z99999. How can i do it?

 

I have this table:

FROMTOVALUE
1A000002Z99999Value 1
3A000007Z99999Value 2
8A000008Z99999Value 3
9A000009Z99999Value 4

 

I need a filter to check if i ask for register "1B45877" returns Value 1. If i ask for "8G74584" returns Value 3...

1 ACCEPTED SOLUTION
HotChilli
Super User
Super User

If the table provided is TableK and these values 1B45877, 8G74584 are in a table (TableP) - which is not connected with a relationship -

and are then pulled in to a table visual, you can create a measure :

MeasureA = VAR _PVal = MIN(TableP[Column1])
RETURN
CALCULATE(MIN(TableK[VALUE]), TableK[FROM] <= _PVal && TableK[TO] >= _PVal) 

 This will require testing because it relies on < , > working for the alphabetical comparison so I suggest testing edge cases.  In my head it feels OK but I may be wrong.

View solution in original post

7 REPLIES 7
v-yalanwu-msft
Community Support
Community Support

Hi, @marrasate ;

As @HotChilli said , you could use measure as follow:

Measure = CALCULATE(MAX('Table'[VALUE]),FILTER('Table',[FROM]< MAX('register'[register])&&[TO]>MAX('register'[register])))

The final output is shown below:

vyalanwumsft_2-1644547633099.png

vyalanwumsft_3-1644547645950.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

HotChilli
Super User
Super User

If the table provided is TableK and these values 1B45877, 8G74584 are in a table (TableP) - which is not connected with a relationship -

and are then pulled in to a table visual, you can create a measure :

MeasureA = VAR _PVal = MIN(TableP[Column1])
RETURN
CALCULATE(MIN(TableK[VALUE]), TableK[FROM] <= _PVal && TableK[TO] >= _PVal) 

 This will require testing because it relies on < , > working for the alphabetical comparison so I suggest testing edge cases.  In my head it feels OK but I may be wrong.

HotChilli
Super User
Super User

If you want a good answer you'll have to be clearer about:

a) what you have to start with

b) what you want to end with

c) an explanation of how to get from a) to b) 

I have this table:

FROMTOVALUE
1A000002Z99999Value 1
3A000007Z99999Value 2
8A000008Z99999Value 3
9A000009Z99999Value 4

 

I need a filter to check if i ask for register "1B45877" returns Value 1. If i ask for "8G74584" returns Value 3...

marrasate
Regular Visitor

Im trying to do this:

 

FROMTOVALUE
1A000002Z99999Value 1
3A000007Z99999Value 2
8A000008Z99999Value 3
9A000009Z99999Value 4
HotChilli
Super User
Super User

Are you trying to generate the values 1A00000, 1A00001, 1A00002........ in a column?

amitchandak
Super User
Super User

@marrasate , Create a measure and plot it with the required column

 

countrows(filter(Table, Table[column] >= '1A00000'  and Table[column]<= '2Z99999' ))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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