EN VI

Powerbi - How can I filter "this year before today" in Power BI?

2024-03-15 03:00:07
Powerbi - How can I filter "this year before today" in Power BI?

I am considering whether to add a column called ‘this_year_before_today’ to my date table. The purpose of this column would be to identify whether a date falls within the current year up to today.

Here’s the formula I would be using for the calculated column:

this_year_before_today = IF(YEAR([date]) = YEAR(TODAY()) && [Date] <= TODAY(), TRUE(), FALSE())

Until now, I’ve been relying on two filters to visualize data for this date period:

  1. Relative date “is this year”: This filter restricts the visual to the current year, including dates after today.
  2. Relative date “is in the last year": This filter restricts the visual to dates before today.

However, I find both solutions somewhat cumbersome. Is there a more efficient way to achieve this?

I can use either filters for each visual, create a column in my date table, or insert filtering in DAX measures

Solution:

I would create two columns in your date table:

  • YearOffset

  • DayOffset.

Then add two filters:

YearOffset = 0

DayOffset < 0

I use both of those fields a lot in various reports

Answer

Login


Forgot Your Password?

Create Account


Lost your password? Please enter your email address. You will receive a link to create a new password.

Reset Password

Back to login