Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi there,
I have data in this format:
I'm trying to create filters for the data:
The first filter is the year, followed by the period and then the week. The data I get after applying these filters is correct.
Now, I've tried using the 'sameperiodlastyear' function to retrieve data from the previous year with the same period and week, but it's not working. Can you please help me?
Thanks.
sorry i am beginer in powerbi adn the video is way advanced.
Hi @sandeepvig ,
Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng
here is the link please find the file attached
HI @sandeepvig,
You can try to use the following measure formula if they suitable for your requirement:
CY Sales UM =
CALCULATE (
SUM ( 'UM WEEKLY'[Sales] ),
ALLSELECTED ( 'UM WEEKLY' ),
VALUES ( 'UM WEEKLY'[Year] ),
VALUES ( 'UM WEEKLY'[period] ),
VALUES ( 'UM WEEKLY'[week] )
)
PY Sales UM =
VAR currYear =
MAX ( 'UM WEEKLY'[Year] )
RETURN
CALCULATE (
SUM ( 'UM WEEKLY'[Sales] ),
FILTER ( ALLSELECTED ( 'UM WEEKLY' ), 'UM WEEKLY'[Year] = currYear - 1 ),
VALUES ( 'UM WEEKLY'[period] ),
VALUES ( 'UM WEEKLY'[week] )
)
Regards,
Xiaoxin Sheng
@sandeepvig See if this video helps, it has week examples like what you want.
HI @sandeepvig,
Time intelligence functions should base on the hidden calendar table so I think you can't directly use it to work with a fiscal date field value.
For this scenario, you can try to extract the current date value and use date function to manually define the filter ranges based on that variable.
Time Intelligence "The Hard Way" (TITHW)
Regards,
Xiaoxin Sheng
i tried but didn't worked
@sandeepvig that's unfortunate because you must have a use case not anticipated by everyone who has ever used Power BI. I would have thought that a date table that included fields such as Calendar Year/Month/Week and Fiscal Year/Month/Week (because you appear to have a 4-4-5 fiscal calendar) and it was marked as a date table it would be very easy to solve this with some time intelligence functions. But apparently your use case is something brand new. Since this is a completely new, unanticipated use case I would suggest raising an idea at https://ideas.powerbi.com. Maybe a future solution can be developed that remedies your needs. Because, as you said, "i (sic) tried but didn't worked (sic)".
@Ashish_Mathur is excellent at this kind of thing. I'm certain he'd love to help you!
Hi @sandeepvig
It's almost a requirement that every data model has a date table. If you had one and it were marked appropriately, this would be very easy to solve. Highly recommend incorporating one into your model.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
66 | |
54 | |
47 | |
36 | |
34 |
User | Count |
---|---|
84 | |
70 | |
58 | |
45 | |
44 |