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
Anonymous
Not applicable

Need help to getting the correct rates based on dates

Hi all, 

Need some help to get the price of rates based on dates. 


Previously , i am using month to get the price of the rate but on some date of the month the rate price been changed and i need to get based on dates of calendar which i have created in another table.

 

Here are the table of rates with price:

Hairul_Khumaini_1-1669791702439.png

 

Here table with the calendar :

Hairul_Khumaini_2-1669792235474.png

 

Current output:

Hairul_Khumaini_3-1669792763625.png

 

Expected output :

I would like to use rate from dates before 10 november will using rate 0.435 and after will be using 0.380 (based on the first table) .  Need some help to achieve this. 

 

Thanks in advance 

 

1 ACCEPTED SOLUTION
TomasAndersson
Solution Sage
Solution Sage

You might have to adjust table/column names, but something like below. The measure looks for the latest entry in the Rates table that is on or before the current date.

CurrMonth First Tariff = 
CALCULATE(
    LOOKUPVALUE('Rates'[Rate],'Rates'[Start Date],maxx('Rates','Rates'[Start Date])),
    'Rates'[Description] = "For Tariff less than 200",
    FILTER(ALL(Calendar), Dates[Calendar]<=max(Calendar[Date])))

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Adjusted the columns to the correct one as @TomasAndersson said and it works . Thanks

TomasAndersson
Solution Sage
Solution Sage

You might have to adjust table/column names, but something like below. The measure looks for the latest entry in the Rates table that is on or before the current date.

CurrMonth First Tariff = 
CALCULATE(
    LOOKUPVALUE('Rates'[Rate],'Rates'[Start Date],maxx('Rates','Rates'[Start Date])),
    'Rates'[Description] = "For Tariff less than 200",
    FILTER(ALL(Calendar), Dates[Calendar]<=max(Calendar[Date])))

 

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.