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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
danyeungw
Helper II
Helper II

How to get Report Date = Slicer Latest Selected Date

I created a measure named "Selected Date' to get the latest selected date from a slicer. The date returned corrected. See Image. I created another measure to assign "Quarter End" or "Current". See the code below.  The "Quarter End" is correct. However, all other rows had "Current". I want the rows with Report Date "3/8/2023" in this example to have "Current".  What is wrong in the code? Or is there another way to do it? Thanks.

 

 

Quarters = if(ENDOFQUARTER('Table1'[ReportDate].[Date])= 'Table1'[ReportDate],"Quarter End",if('Table1'[ReportDate].[Date] = [Selected Date],"Current","")) 

 

Selected Date = LASTDATE('Table1'[ReportDate])

 

danyeungw_0-1678914073084.png

 

4 REPLIES 4
danyeungw
Helper II
Helper II

I think I know why all rows are Current, but don't know how to fix it. I am thinking if I can get the constant from "Selected Date", it may work. It is 3/4/2023 in this example.
I don't think I can attach a file here.

 

 

 

Quarters = if(ENDOFQUARTER('Table1'[ReportDate].[Date])= 'Table1'[ReportDate],"Quarter End",if('Table1'[ReportDate].[Date] = [Selected Date],"Current",""))

Selected Date = LASTDATE('Table1'[ReportDate])

SelectedDate = FORMAT([Selected Date],"MM/DD/yyyy")

 

 

danyeungw_3-1678997884377.png

 

 

 

Ashish_Mathur
Super User
Super User

Hi,

Could you share the download link of the PBI file.


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

write like this:

Quarters=
VAR = _MaxSelectedDate = max('Table1'[ReportDate])
RETURN
Quarters = if(ENDOFQUARTER('Table1'[ReportDate].[Date])= 'Table1'[ReportDate],
 "Quarter End",if('Table1'[ReportDate].[Date] = _MaxSelectedDate,"Current","")) 

Thanks @Ahmedx , I got an error "Unexpected expression =" on VAR =. I modified it to the followings. All rows except the "Quarter End" had "Current".

Quarters = if(ENDOFQUARTER('Table1'[ReportDate].[Date])= 'Table1'[ReportDate],
 "Quarter End",if('Table1'[ReportDate].[Date] = max('Table1'[ReportDate]),"Current","")) 

OR

Quarters = if(ENDOFQUARTER('Table1'[ReportDate].[Date])= 'Table1'[ReportDate],
"Quarter End",if('Table1'[ReportDate].[Date] = LASTDATE('Table1'[ReportDate]),"Current",""))

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors