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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
Aoi
New Member

Measure based on specific value

Hi,

 

*I'm Japanese, so my English might be a bit strange.

 

I have two table:

 1. Sales data (fact)

 2. Reference price (dimention)

 

Table 1 

Aoi_0-1681977996276.png

 

Table 2

This table provides reference unit prices by sales quantity to perform appropriate pricing.

Aoi_1-1681978210929.png

These tables have relationship on "Product Name".

 

 

Then I want to create such a table below;

 - The aggregation of the data is summarized by Client Group.

 - Create a mesure that based summury of quantity and reference price corresponding applicable quantety.

Aoi_2-1681978521734.png

 

I created a measure bleow but the table with this measure is not working correctly.

*This code is in Japanese, so I will provide a simplified version below.

Aoi_3-1681979369795.png

 

 

Reference Price =
if([Quantity]<max('Table 2'[Applicable quantity 2]),
   max('Table 2'[Reference Price 1],

  if(and([Quantity]>=max('Table 2'[Applicable quantity 2]),
         [Quantity]<max('Table 2'[Applicable quantity 3])),
         max('Table 2'[Reference Price 2])),
          
         if(                   //'omittion

 

 

A table with this measure returns a nonsensical answer...
If I filter at Product Name = [aaa], this table is returning rows with product names that have no relation and both Client Group and Reference Price have values that are different from the actual ones, and Quantity is blank. Onlu the first row is correct.

Aoi_4-1681979818367.png

 

Thanks a lot for your help..!

Aoi

 

 

2 REPLIES 2
v-zhangti
Community Support
Community Support

Hi, @Aoi 

 

You can try the following methods.

Measure = 
Var _quantity=SUM(Table1[Quantity])
Var _quantity_1=CALCULATE(MAX(Table2[Applicable quantity 1]),FILTER(Table2,[Product Name]=SELECTEDVALUE(Table1[Product Name])))
Var _Price_1=CALCULATE(MAX(Table2[Reference Price 1]),FILTER(Table2,[Product Name]=SELECTEDVALUE(Table1[Product Name])))
Var _Price_2=CALCULATE(MAX(Table2[Reference Price 2]),FILTER(Table2,[Product Name]=SELECTEDVALUE(Table1[Product Name])))
Return
IF(_quantity<_quantity_1,_Price_1,IF(_quantity>_quantity_1,_Price_2))

vzhangti_0-1682407284003.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

 

Thank you for your reply!

 

I tried this measure, but  an error below occured...

it exceeded the resources available to the visual 

 
It maybe becouse of my bad data modeling.

So I will review that.

 

Thanks a lot for your help...!

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.