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, I know there are several topics about that, but yet I failed to transfer the solutions to my problem. Hope you can help.
I have a calendar table Date, with the column Date. In the same table I have a column [Future Date], which is 1 from the past until today and 0 for future dates.
I build a matrix with two columns. First column is Date[Date] and the second ist:
VAR Before =
Solved! Go to Solution.
Hi @H3nning , Thank you for reaching out to the Microsoft Community Forum.
Please try below:
PreviousYearDate =
VAR MinDate = MIN(Date[Date])
RETURN
IF(
NOT ISBLANK(MinDate) && CALCULATE(MAX(Date[Future Date]), Date[Date] = MinDate) = 1,
DATE(
YEAR(MinDate) - 1,
MONTH(MinDate),
DAY(MinDate)
),
BLANK()
)
If this helped solve the issue, please consider marking it “Accept as Solution” and giving a ‘Kudos’ so others with similar queries may find it more easily. If not, please share the details, always happy to help.
Thank you.
Hi @H3nning , Just checking in—were you able to resolve the issue?
If one of the replies helped, please consider marking it as "Accept as Solution" and giving a 'Kudos'. Doing so can assist other community members in finding answers more quickly.
Thank you!
Hi @H3nning ,
I hope the information shared was helpful. If you have any additional questions or would like to explore the topic further, feel free to reach out. If any of the responses resolved your issue, please mark it "Accept as solution" and give it a 'Kudos' to support other members in the community.
Thank you!
Hi @H3nning ,
I wanted to follow up and see if you’ve had a chance to review the information provided here.
If any of the responses helped solve your issue, please consider marking it "Accept as Solution" and giving it a 'Kudos' to help others easily find it.
Let me know if you have any further questions!
Hi @H3nning ,
Not sure but the code you supplied is it a measure or a column? Also I'm confused about the question you refer of teh column for future dates with 0 and 1, in terms of calculation because if you have this column then you can add it has a filter to the matrix and make sure that it will only return the 1 values so past dates.
Can you please explain a litle bit better the question and what you are doing and expected result so I can understand the final result and what is happening.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi, of course. It is a measure.
What I do is exactly what you mentioned. I use the Future Date column to filter the Date[Date] column in my matrix. That works fine as long as I dont put the measure in.
So without the Filter the Matrix on year level looks like this:
Year |
2022 |
2023 |
2024 |
2025 |
2026 |
2027 |
When I put in the future date it looks like this:
Year |
2022 |
2023 |
2024 |
2025 |
So far so good. But the measure brings back 2026 and 2027 to the matrix, but not the data behind it. That is why the term YEAR(Min(Date[Date]))-1 returns -1 for those years. Why are these years coming back, when putting in the measure as a second column?
Hi @H3nning , Thank you for reaching out to the Microsoft Community Forum.
Please try below:
PreviousYearDate =
VAR MinDate = MIN(Date[Date])
RETURN
IF(
NOT ISBLANK(MinDate) && CALCULATE(MAX(Date[Future Date]), Date[Date] = MinDate) = 1,
DATE(
YEAR(MinDate) - 1,
MONTH(MinDate),
DAY(MinDate)
),
BLANK()
)
If this helped solve the issue, please consider marking it “Accept as Solution” and giving a ‘Kudos’ so others with similar queries may find it more easily. If not, please share the details, always happy to help.
Thank you.
I could solve it myself, but I don't know why this happens. Maybe someone can explain?
The result of YEAR(Min(Date[Date]))-1 for future dates is -1, which cannot be converted into a year in the date function. But why is this even calculated for future dates? Shouldnt these be filtered out and therefor no calculation for them takes place?
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 |
---|---|
73 | |
71 | |
55 | |
38 | |
31 |
User | Count |
---|---|
71 | |
64 | |
62 | |
50 | |
46 |