The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hello Experts,
I am new to Power BI, I have a requirement in which I ran a report for prior month, and I want to automate the year. I can easily do as format(today(),"YYYY") but the issue is that next year for Jan 2025, when I will run the report I need 2024 as year. So I want to understand how to automate this. As FYI, I want to use Today() function to make it dynamic as I do not have any date in my data.
Thanks in advance
Ferha
Solved! Go to Solution.
Read about DATEADD() - it allows you to do your shifts by month or by year etc.
It is mandatory that your data model includes a calendar table and that the time intelligence DAX is applied on that table.
Thanks for the reply from lbendlin , please allow me to provide another insight:
Hi @Ferha_Jafri ,
Here are the steps you can follow:
1. Create measure.
Flag =
var _maxdate=
EOMONTH(
TODAY(),-1)
var _mindate=
EOMONTH(
TODAY(),-2)
return
IF(
MAX('Table'[Date]) >_mindate&& MAX('Table'[Date])<=_maxdate,1,0)
Sum_Measure =
SUMX(
ALLSELECTED('Table'),[rand])
2. Place [Flag]in Filters, set is=1, apply filter.
3. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Read about DATEADD() - it allows you to do your shifts by month or by year etc.
It is mandatory that your data model includes a calendar table and that the time intelligence DAX is applied on that table.