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
Syndicate_Admin
Administrator
Administrator

Calculate difference between rates versus previous day

Hello community,

I'm trying to calculate the daily variation between one rate and the previous one. I'm using the formula:

Variacion_Tasa = ([Int.Pond.] - CALCULATE([Int.Pond.],PREVIOUSDAY(DIM_TIEMPO[PERIOD])))
Where Int.Pond. = DIVIDE(SUM('MIS_RATE_DETAIL_2'[BCEXRATE]),SUM('MIS_RATE_DETAIL_2'[BCE_DOP]))
However, the graph does not have the correct value:
Variation:
For July 13 for example, the variation should be 9.26 - 9.32 = -0.06
chris_pbi_0-1660247660352.png

Daily rate:

chris_pbi_1-1660247699493.png

I appreciate your help.

3 REPLIES 3
v-rzhou-msft
Community Support
Community Support

Hi @Syndicate_Admin ,

 

I think your measure should be correct. As far as I know, PREVIOUSDAY() should be time intellgience function, DIM_TIEMPO table should contains continuous date in it. Here I suggest you to create DIM_TIEMPO table by CALENDAR() or CALENDARAUTO() function.

DIM_TIEMPO = CALENDAR(MIN(MIS_RATE_DETAIL_2[Date]),MAX(MIS_RATE_DETAIL_2[Date]))

Data model in my Sample:

RicoZhou_2-1660721687634.png

RicoZhou_0-1660721662967.png

Result is as below.

RicoZhou_1-1660721675414.png

 

Best Regards,
Rico Zhou

 

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

 

Thank you! @Syndicate_Admin

amitchandak
Super User
Super User

@Syndicate_Admin , Make sure DIM_TIEMPO is marked as date table

 

Date from DIM_TIEMPO is used in visual and slicer

 

The date in MIS_RATE_DETAIL_2 does not have a timestamp

and join between MIS_RATE_DETAIL_2and DIM_TIEMPO is single directional

 

Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5b...

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.