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
mthomas1973
Helper I
Helper I

SAMPERIODLASTYEAR and visual filters

Good afternoon. 

 

I have a requirement that shows a measure, and the same period last year in the same table. This is easy enough with the following: 

 

CALCULATE([MEASURE], SAMEPERIODLASTYEAR('D Date'[Date]) )

And that gives me a nice table: 

 

mthomas1973_0-1659357047149.png

 

I want the table to be filtered for the last day in a month though (so we see performance on the 30th June, 31st May, etc...) like this:

 

mthomas1973_2-1659357528653.png

When I filter the table for a month-end-flag in the date table I get the error about continuous dates (understandable). It is a pretty simple relationship in the model: 

 

mthomas1973_1-1659357437011.png

 

 

So, my question:

 

Can I filter sameperiodlastyear in this context with a different approach? 

If not, I can use something like 

'D Date'[Date]=EDATE(SELECTEDVALUE('D Date'[Date]),-12)

But does this have any limitations that I don't know about (end of Februarys, for example)?

 

What is best practice here? 

 

Any help appreciated. 

 

 

 

2 REPLIES 2
amitchandak
Super User
Super User

@mthomas1973 , The flag is in the date table? and relation with fact is single directional?

Hi @lamth , thank you for your reply. 

Yes, the flag is a simple 1 or 0 in the date table and it is has a single directional relationship with the fact table. 

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.