Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
sgupta22
Helper II
Helper II

Return minimum selected year of slicer

Hi all,

 

I am trying to return the minimum selected value of a year slicer across all years. I tried using the following code, however, it seems that SELECTEDVALUE cannot be used with a date range. 

 

MINX(SELECTEDVALUE('Calendar'[Year]))
 
I can use the ALLSELECTED function but that returns the minimum value of the entire slicer not the minimum SELECTED value. 
 
Any help is appreicated.
 
Thanks
Shashank
 
2 ACCEPTED SOLUTIONS

Hi,

To both visuals, drag the year column from the calendar Table (not from the Date hierarchy).

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

You are welcome.  Does this measure work?

Revenue in first year of selection = calculate(SUM(Data[Total revenue),datesbetween(calendar[date],date([first selected year],1,1),date([first selected year],1,1)))

I have assumed that Total revenue is a column in the Data Table.  First selected is a measure which i shared with you in  my previous post.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

12 REPLIES 12
vugdipati
Regular Visitor

What is the DAX to get the beginning of the year ? Please provide the same

Ashish_Mathur
Super User
Super User

Hi,

Does this measure work?

Minimum selected year = MIN('Calendar'[Year])


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks for your reply Ashish.  This is not quite what I am looking for.  The values that this gives me are these:

sgupta22_1-1673839668810.png

What I want is the beginning date column to return the minimum selected value of the slicer (which is 2016 in my case) across all the years.

 

Thanks 

Hi,

Assuming Year has been dragged from the Calendar Table, try this measure

Minimum selected year = MINX(ALLSELETED(Calendar[Year]),Calendar[Year])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks again Ashish! I tried this before and although it gives me the minimum year of the slicer, it doesn't give the selected minimum (in my case, I have the slicer range from 2000 to 2022 but I have selected it from 2016 to 2022 - and thus, I want the year to be the selected minimum). 

 

sgupta22_0-1673842192724.png

Regards

Shashank

You are welcome.  That is strange - the ALLSELECTED() function should have caught your selected years only.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks Ashish. I have just created a new file trying to replicate this and get the same results unfortunately.  Don't know what I am doing wrong.  Anyway, thanks for taking the time to answer my queries. Appreciate it.

 

https://www.dropbox.com/s/ex851tvibrj76gd/Beginning%20Year%20Selected.pbix?dl=0

Hi,

To both visuals, drag the year column from the calendar Table (not from the Date hierarchy).

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Perfect! thank you so much. 

 

Just one follow up if I can - I am now trying to display the revenue that corresponds to the year 2016 across all the years to be used in a formula but can't get it to work. I am using the following formula:

 

sgupta22_0-1673849433569.png

 

However, this is the result that I get:

 

sgupta22_1-1673849523526.png

I want 40.74 (which is the revenue for year 2016) to be displayed across all years.

 

Thanks again!

 

 

You are welcome.  Does this measure work?

Revenue in first year of selection = calculate(SUM(Data[Total revenue),datesbetween(calendar[date],date([first selected year],1,1),date([first selected year],1,1)))

I have assumed that Total revenue is a column in the Data Table.  First selected is a measure which i shared with you in  my previous post.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Yes it does!! Thank you so much 🙂

 

Have a great day

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.