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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
srangu
New Member

Dynamically calculate and fetch the maximum of date in visual, based on date slicer selection.

Hi,

 

I have a requirement in one of my reports where I should be filtering and fetching the maximum of a date based on a date slicer selection i.e., If i select a date range from the date slicer, the slicer should filter the visual having only one record that holds the maximum of the date available(less than or equal to end date of the date range slicer) and if the end date of the date range slicer changes based on the end user selection, the filteration and fetch of that one record having the maximum date should be displayed in the visual.  

 

Screenshots and description given below for a better understanding,

First.PNG

 

when considering the above screen shot for the id 158440 we are having 4 records and based on the slicer selection made, only the maximum(Highlighted) should be shown.

second.PNG

 

 

In the second pic above, the end date of the slicer is changed, now the visual should be showing the current maximum record(Highlighted) based on the end date selection.

 

Let us know if any further information is needed.

 

Please let us know if there is a workaround for the above scenario. Requesting for a reply ASAP as many reports in plan depend on this functionality.

2 ACCEPTED SOLUTIONS
littlemojopuppy
Community Champion
Community Champion

Hi @srangu try this:

MAXX(
	VALUES(DateTable[Date])
	DateTable[Date]
)

View solution in original post

v-stephen-msft
Community Support
Community Support

Hi @srangu ,

 

Try to create the following measure, add it into visual level filters, set show items when the value is 1.

Measure = IF(MAX('Table'[Date])=CALCULATE(MAX('Table'[Date]),ALLSELECTED('Table')),1)

CALCULATE(MAX('Table'[Date]),ALLSELECTED('Table')) returns the max date in the slicer.

vstephenmsft_0-1644828557101.png

 

If the slicer max date is changed to 1/25/2022, the visual also changes.

vstephenmsft_1-1644828577948.png

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-stephen-msft
Community Support
Community Support

Hi @srangu ,

 

Try to create the following measure, add it into visual level filters, set show items when the value is 1.

Measure = IF(MAX('Table'[Date])=CALCULATE(MAX('Table'[Date]),ALLSELECTED('Table')),1)

CALCULATE(MAX('Table'[Date]),ALLSELECTED('Table')) returns the max date in the slicer.

vstephenmsft_0-1644828557101.png

 

If the slicer max date is changed to 1/25/2022, the visual also changes.

vstephenmsft_1-1644828577948.png

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

littlemojopuppy
Community Champion
Community Champion

Hi @srangu try this:

MAXX(
	VALUES(DateTable[Date])
	DateTable[Date]
)

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.