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

Win a FREE 3 Day Ticket to FabCon Vienna. Apply now

Reply
ngct1112
Post Patron
Post Patron

How to create a measure to MAP QTY range

Hi, I am trying to create a measure to map with 2 tables.

 

How could I SUM the "QTY" from Table 1 (250+120+100+30+310+60 = 870)

Then MAP "870" to Table 2 to find out the "QTY Band" as "501 - 1000" so that to lookup to the
1.) Unit Price as "150"

2.) ID as "8"

Here is my Trial but not really working

 

 

Measure = MAXX(Filter(SUMX(Table 1, Table 1[QTY]) > Table 2[From], Table 2[QTY Band])

 

 

Appreciate if any help. Here is the Example

 https://drive.google.com/file/d/1Pgs73Q9w6vrUjVHrqChixi1inink0uB2/view?usp=sharing 

 

Table 1

 

Product

QTY

1

100

2

50

3

100

4

30

5

50

6

60

 

Table 2

 

 

 

 

From

To

QTY Band

Unit Price

ID

1

25

1 - 25

230

1

1

25

1 - 25

250

2

26

100

26 - 100

220

3

101

250

101 - 250

200

4

101

250

101 - 250

210

5

251

500

251 - 500

180

6

251

500

251 - 500

160

7

501

1000

501 - 1000

150

8

1001

5000

1001 - 5000

100

9

 

 
 

Capture.JPG

 

 

 

 



1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @amitchandak , 

 

Try this:

MAX Unit Price =
CALCULATE (
    MAX ( 'Table 2'[Unit Price] ),
    FILTER ( 'Table 2', 'Table 2'[QTY Band] = [Lookup QTYBand] )
)
MAX Unit Price ID = 
CALCULATE (
    FIRSTNONBLANK ( 'Table 2'[ID], 1 ),
    FILTER (
        'Table 2',
        'Table 2'[QTY Band] = [Lookup QTYBand]
            && 'Table 2'[Unit Price] = [MAX Unit Price]
    )
)

max.JPG

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Icey
Community Support
Community Support

Hi @amitchandak , 

 

Try this:

MAX Unit Price =
CALCULATE (
    MAX ( 'Table 2'[Unit Price] ),
    FILTER ( 'Table 2', 'Table 2'[QTY Band] = [Lookup QTYBand] )
)
MAX Unit Price ID = 
CALCULATE (
    FIRSTNONBLANK ( 'Table 2'[ID], 1 ),
    FILTER (
        'Table 2',
        'Table 2'[QTY Band] = [Lookup QTYBand]
            && 'Table 2'[Unit Price] = [MAX Unit Price]
    )
)

max.JPG

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@ngct1112 , I think you need Dynamic Segmentation.

See if my video can help:https://youtu.be/CuczXPj0N-k

or these

https://www.daxpatterns.com/dynamic-segmentation/
https://www.daxpatterns.com/static-segmentation/
https://radacad.com/grouping-and-binning-step-towards-better-data-visualization

 

Please provide your feedback comments and advice for new videos
Tutorial Series Dax Vs SQL Direct Query PBI Tips
Appreciate your Kudos.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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