Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateJoin 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,
I use a table F_DOSSIERS with the fields EMPLOYEE, REGION, OFFICE, CREATION_DATE, AMMOUNT_DOSSIERS:
I added a slicer to my report based on the field CREATION_DATE:
When I choose two dates between:
I want to see 4 dates depending on the two dates selected in the slicer:
Start Previous Year gives me the beginning of the month of the from value in the slicer minus a year: 1/5/2020 → 01/01/2019
End Previous Year gives me the end of the month of the till value in the slicer minus a year: 3/28/2020 → 31/3/2019
Start gives me the beginning of the month of the from value in the slicer: 1/5/2020 → 01/01/2020
End gives me the end of the month of the till value in the slicer: 3/28/2020 → 31/3/2020
Maybe I should do this with 4 measures, but then I need to get the two values from the slicer.
How can I do this?
Thanks,
R.W.
Solved! Go to Solution.
Hi @Anonymous ,
You may create measures like DAX below.
Measure Min Date = CALCULATE(MIN (F_DOSSIERS[CREATION_DATE]), ALLSELECTED(F_DOSSIERS[CREATION_DATE]))
Measure Max Date = CALCULATE(MAX (F_DOSSIERS[CREATION_DATE]), ALLSELECTED(F_DOSSIERS[CREATION_DATE]))
Measure Start = EOMONTH([Measure Min Date], -1)+1
Measure End = EOMONTH([Measure Max Date], 0)
Measure Start Previous Year = EOMONTH([Measure Min Date], -13)+1
Measure End Previous Year = EOMONTH([Measure Max Date], -12)
Best Regards,
Amy
Community Support Team _ Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
You may create measures like DAX below.
Measure Min Date = CALCULATE(MIN (F_DOSSIERS[CREATION_DATE]), ALLSELECTED(F_DOSSIERS[CREATION_DATE]))
Measure Max Date = CALCULATE(MAX (F_DOSSIERS[CREATION_DATE]), ALLSELECTED(F_DOSSIERS[CREATION_DATE]))
Measure Start = EOMONTH([Measure Min Date], -1)+1
Measure End = EOMONTH([Measure Max Date], 0)
Measure Start Previous Year = EOMONTH([Measure Min Date], -13)+1
Measure End Previous Year = EOMONTH([Measure Max Date], -12)
Best Regards,
Amy
Community Support Team _ Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@v-xicai
Thanks,
This almost works perfectly.
Only I get 02/01/2020 (dd/mm/yyyy) for [Measure Start] when I set the from-slider on the slicer on 01/01/2020 (dd/mm/yyyy).
How ackward!
The [Measure Start Previous Year] is correct on 01/01/2019 (dd/mm/yyyy).
R.W.
@Anonymous try following measures
Min Date = MIN ( Table[CreationDate] )
Max Date = MAX ( Table[CreationDate] )
start of year py = DATE(YEAR([Min Date])-1,1,1)
start of year ty = DATE(YEAR([Min Date]),1,1)
end of month ty = EOMONTH([Max Date],0)
end of month py = EOMONTH(DATE(YEAR([end of month])-1,month([end of month]),1),0)
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Thanks
I could use the measures for Min Date en Max Date. The other measures were not exactly as needed, but I could correct them.
@Anonymous As a best practice, add date dimension in your model and use it for and time intelligence calculations. There are many posts on how to add date dimension and below is the link to a few. Once the date dimension is added, mark it as a date table on table tools.
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
https://radacad.com/create-a-date-dimension-in-power-bi-in-4-steps-step-1-calendar-columns
Once this data table is in the model, use slicer from here and all the calculations based on this date dimension.
I tested everything my end, and it worked fine. Share pbix file if you still run into an issue
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
61 | |
61 | |
55 | |
38 | |
27 |
User | Count |
---|---|
85 | |
60 | |
45 | |
41 | |
39 |