Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowHello,
I have a date table and each date is tagged for sales calendar month. the field called "Sale Month-Year"
Last year my July sales calendar started from 7/1/2022 and ended on 8/1/2022 whereas this year July 2023 started from 7/1/2023 and going to end 7/31/2023. When I run samperiodlastyear function, it only picks data from 7/1/2022 to 7/31/2022 and misses 8/1/2022.
When I filter for July 2023, how can I pick last year data where "Sale Month-Year" is July 2022 (including 8/1/2022)?
Thank you in advance!
Arif
Solved! Go to Solution.
Hi @arif_ali
You can refer to the following example .
Sampel data
Last_year
This_year
Then create a measure
Measure = var a=EOMONTH(MAXX(ALLSELECTED(This_year),[Date]),-13)+1
var b=EOMONTH(MAXX(ALLSELECTED(This_year),[Date]),-12)+1
return IF(SELECTEDVALUE(Last_year[Date])>=a&&SELECTEDVALUE(Last_year[Date])<=b,1,0)
Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @arif_ali
You can refer to the following example .
Sampel data
Last_year
This_year
Then create a measure
Measure = var a=EOMONTH(MAXX(ALLSELECTED(This_year),[Date]),-13)+1
var b=EOMONTH(MAXX(ALLSELECTED(This_year),[Date]),-12)+1
return IF(SELECTEDVALUE(Last_year[Date])>=a&&SELECTEDVALUE(Last_year[Date])<=b,1,0)
Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
User | Count |
---|---|
98 | |
69 | |
66 | |
49 | |
41 |