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.
Hello Folks,
Just I am marking MTD, MTD Last Year and others in Calendar table , using below DAX and getting correct result but in Last Year MTD calculations giving me full month .
For example like Today 7th 2021 so MTD would be 1-7th Feb of 2021
but for Last Year MTD - It should 1-7th Feb2020
Current_Month_LYSM = SWITCH(Dates[Month_Diff],0,"CM",1,"LM",12,"LYSM","Other Months")
I dont have to use any measure like TotalMTD(sum(sales))) like this.
I have to idicate based on Dates.
Thanks
That is by design. You need to add a column in your Dates table that flags all the days that are one year older or more than today (or one month older etc depending on what you compare), and then you need to add that flag as a filter in the calculation
Something like
Previous Year To Date =
calculate(something something, SAMEPERIODLASTYEAR(sales[date]),dates[isinpreviouspast]=TRUE())
Note that I said column, so this assumes that you are refreshing your dataset daily.
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 |
---|---|
10 | |
9 | |
9 | |
8 | |
8 |
User | Count |
---|---|
14 | |
12 | |
11 | |
11 | |
8 |