March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello, I have a visual where I would like to display only data for the last 12 complete months. For example, if today is 5/12/2021, the data I would like to be displayed would be running from 4/1/2020 to 4/30/2021. Every month has a full month's worth of data.
Right now I have this DAX, but PBI gives me errors on formatting and values when comparing the dates for some reason.
Solved! Go to Solution.
Hope you tried my solution to your problem, let me know if it works.
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
This is the DAX forum so it's no surprise you've got a DAX answer. I'd just point out this functionality is available in the UI. Use a relative date slicer or filter with calendar month.
Hi Paul. You are correct that it is available in the UI. But if you notice, this does not meet my requirements as the data that is being filtered in does not start at the beginning and end of each month.
@matsahiro
Please use the following formula to have the desired results:
Rolling 12 Month Ind =
VAR CurrentDate = SELECTEDVALUE(Sales[Date_Sold])
VAR Start_Date =
EOMONTH( TODAY() , -14 )+1
VAR End_Date =
EOMONTH ( TODAY(), -1 )
RETURN
IF ( CurrentDate >= Start_Date && CurrentDate <= End_Date, 1, 0 )
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Hope you tried my solution to your problem, let me know if it works.
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Definitely gave it a go. The IF statement ended up not working for a specific visual I had, but I simply threw in the same logic in a CALCULATE statement.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
25 | |
18 | |
15 | |
9 | |
8 |
User | Count |
---|---|
37 | |
32 | |
16 | |
16 | |
12 |