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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Bobass75
Regular Visitor

Time intelligence - value of last month of previous year

Maybe it's simple, but I'm stuck - in this context, when selecting one month of current year (in eg Feb 2011) , I need to show the value from the last month of the previous year (so 150, Dec 2010). Thank you in advance.

 

Bobass75_1-1706823784979.png

 

4 REPLIES 4
v-xuxinyi-msft
Community Support
Community Support

Hi @Bobass75 

 

@talespin GOOD ANSWER!

 

If your problem hasn't been solved yet, you can also try this.

 

1. Create a calculated table as the slicer

Date = VALUES('Table'[Date])

 

2. Create a measure

Measure = 
VAR _1 = YEAR(SELECTEDVALUE('Date'[Date]))
VAR _month = 12
RETURN
IF(MAX([Date]) = SELECTEDVALUE('Date'[Date]) || YEAR(MAX([Date])) = _1 - 1 && MONTH(MAX([Date])) = _month, 1, 0)

 

3. Put the measure into the visual-level filters, set up show items when the value is 1.

vxuxinyimsft_0-1709545635317.png

 

Output:

vxuxinyimsft_1-1709545702451.png

 

Best Regards,
Yulia Xu

 

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

aj1973
Community Champion
Community Champion

Hi @Bobass75 

You don't need the use of Time intelligence for this. You need to get the Value in December of the Previous Year.

Try to adjust this please.

Your Measure = 
VAR _Year = SELECTEDVALUE(Date_table(YEAR))

VAR _PY_Year = _Year - 1

VAR _Result = CALCULATE( CU, Date_table(YEAR) = _PY_Year , Date_table(Month) = 12)
RETURN

_Result

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Hello
I wrote the formula and it does not work

Value - end of PY =
VAR _Year = SELECTEDVALUE(Date_table[Year Number])

VAR _PY_Year = _Year - 1

VAR _Result = CALCULATE( [CU], (Date_table[Year Number] = _PY_Year) , Date_table[Month Number] = 12)
RETURN

_Result


Bobass75_0-1707037213516.png

 



hi @Bobass75 ,

 

Since you have a slicer on date, you need to remove filter on Date when using CALCULATE. I have a Date table and Fact Sales, using below measure to calculate sales for last month previous year.

 

Sales Last Mth PY =
VAR _Year = SELECTEDVALUE(DimDate[CalendarYear])
 
RETURN CALCULATE( [MSalesAmount], REMOVEFILTERS(DimDate), DimDate[CalendarYear] = (_Year - 1) && DimDate[MonthNumberOfYear] = 12)
 
talespin_0-1707042574073.png

 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.

Top Solution Authors