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

Time intelligence question- pulling prior month data

Hi All,

 

I have a problem with the time-intelligence based measure.

 

Its purpose is to pull the value of prior month's exchange rate from a table, which looks as follows:

 

Table name is 'UnpivotedBasic':

 

Table.PNG

The measure to pull the prior month's rate is (not working):

 

Exchange rate from prior month=CALCULATE(SUM(UnpivotedBasic[Value]),DATEADD('Calendar'[Date],-1,MONTH))
 

Functions work separately, I mean if I enter: CALCULATE(SUM(UnpivotedBasic[Value])) it shows the value for the current month and if I type in only DATEADD('Calendar'[Date],-1,MONTH) it correctly shows the prior month but if combined the 'blank' is returned....

 

'Calendar'[Date] is a date table and date range is continuous therein. Accounting rates are only published monthly hence I created a separate 'Calendar'[Date] table. 

 

Regards

Krzysztof

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thank you. I've just solved the issue. It looks the reason was that some other slicer was in conflict with this measure. Having added the 'ALL' function within Calculate helped and it's now working ! 🙂 

View solution in original post

2 REPLIES 2
AllisonKennedy
Super User
Super User

@Anonymous
I'm not sure exactly what your question is - what do you mean it shows the month when you only use the DATEADD?

From what little detail I know about your data, I suggest maybe using a MAX instead of a SUM just in case you ever get more than one entry per month.

PrevMonthExchangeRate=CALCULATE(MAX(UnpivotedBasic[Value]),DATEADD('Calendar'[Date],-1,MONTH))

What visual are you trying to use the measure in? Can you confirm it's a MEASURE and not a column?

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Anonymous
Not applicable

Thank you. I've just solved the issue. It looks the reason was that some other slicer was in conflict with this measure. Having added the 'ALL' function within Calculate helped and it's now working ! 🙂 

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.