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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
siros92
Frequent Visitor

Help needed looking up the right price bracket

Hi awesome community, once again I find myself in need of your assistance. 

 

i've got one table where my sales are, and a seperate table for price agreements. Agreements are volume based and have tiers. Hence i need to lookup the correct price based on the volume in the sales table. For the costs that are fixed this is easily done by:
CALCULATE(VALUES('Price List'[Dayrate]),
FILTER('Price List',
'Price List'[Customer]='Sales'[Customer]
&& 'Sales'[Date]>='Price List'[Price valid from] && 'Sales'[Date]<='Price List'[Price valid to]))

 

However, the variable price based on the brackets seen below is giving me some headache. Is there any way to essentially do the same as above but as well check which bracket level the monthly sales falls into and then return the correct xxx price? I've generated some mock pricing data just to show how the list is structured.

 

CustomerPrice valid fromPrice valid tobracket startBracket endDayratexxx Price
xxxx01.08.202230.06.202302500 £                 10 000,002,5
xxxx01.08.202230.06.2023250112500 £                 10 000,002,2
xxxx01.08.202230.06.20231250150000 £                 10 000,002

In advance thanks for the help and please let me know if there is further details required 🙂

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@siros92 , Also put sales values in the condition

example

 

CALCULATE(max('Price List'[Dayrate]),
FILTER('Price List',
'Price List'[Customer]='Sales'[Customer]
&& 'Sales'[Date]>='Price List'[Price valid from] && 'Sales'[Date]<='Price List'[Price valid to]

&& 'Sales'[value]>='Price List'[bracket start] && 'Sales'[value]<='Price List'[bracket end]

 

))

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@siros92 , Also put sales values in the condition

example

 

CALCULATE(max('Price List'[Dayrate]),
FILTER('Price List',
'Price List'[Customer]='Sales'[Customer]
&& 'Sales'[Date]>='Price List'[Price valid from] && 'Sales'[Date]<='Price List'[Price valid to]

&& 'Sales'[value]>='Price List'[bracket start] && 'Sales'[value]<='Price List'[bracket end]

 

))

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.