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.
Hi,
I am trying to insert 2 new columns into my dataset containing the MIN/MAX values of the date slicer.
I was thinking about the following DAX, but it throws me a circular dependency error.
Min selected date (ALLSELECTED) = CALCULATE( MIN('Calendar'[Date]), ALLSELECTED('Calendar'[Date]) )
Appreciate if anyone would have an idea.
Here is the pbix file:
https://drive.google.com/file/d/1HRjJxByXmLVrgoH9IDnOAlEKHbGytiQo/view?usp=sharing
Solved! Go to Solution.
Hi,
You have to write measures, not calculated column formulas. Delete all column from the Calendar Table except the Date column. Write these measures
Minimum date = CALCULATE(MIN('Calendar'[Date]),ALLSELECTED('Calendar'[Date]))
Maximum date = CALCULATE(MAX('Calendar'[Date]),ALLSELECTED('Calendar'[Date]))
Hope this helps.
Hi @Maikeru
Try the following as columns
MinDate = CALCULATE( MIN('01-MasterCalendar'[Date]),
FILTER(ALL('01-MasterCalendar'[Date]),'01-MasterCalendar'[Year] =YEAR('01-MasterCalendar'[Date]) ))
MaxDate = CALCULATE( Max('01-MasterCalendar'[Date]),
FILTER(ALL('01-MasterCalendar'[Date]),'01-MasterCalendar'[Year] =YEAR('01-MasterCalendar'[Date]) ))
Replace '01-MasterCalendar' with your calendar table name.
Using these expressions it will generate MIn and Max dates for each year in the calendar table.
If this works for you please accept this as solution and also give KUDOS.
Cheers
CheenuSing
Hi,
You have to write measures, not calculated column formulas. Delete all column from the Calendar Table except the Date column. Write these measures
Minimum date = CALCULATE(MIN('Calendar'[Date]),ALLSELECTED('Calendar'[Date]))
Maximum date = CALCULATE(MAX('Calendar'[Date]),ALLSELECTED('Calendar'[Date]))
Hope this helps.
Hi,
What are the min and max date codes doing and when to use it?
Appreciate your explanation.
Hi,
It fetches the first and last date selected in the slicer.
What I meant to understand is what the ALLSELECTED doing inside the CALCULATE function.
Is it always good to use ALLSELECTED while working with dates?
Hi @Ashish_Mathur , is it possible have this as a column?
im saying this because im using a Matrix table so it doesnt allow measures in the rows.
Hi,
Switch to a matrix visual and in the formatting pane, under the Values group, turn on Show on rows.
You are welcome.
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 |
---|---|
72 | |
68 | |
53 | |
39 | |
33 |
User | Count |
---|---|
70 | |
63 | |
57 | |
49 | |
46 |