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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Gjakova
Post Patron
Post Patron

How to: if selected date is before/after the displayed date, then...

Hi there, I have the following issue:

 

I have a list of projects and I want to see if a project is closed or not.

So if I select the date: 20 January 2021 on my date slicer, I want to see the following result:

ProjectEnd DateClosed or Not Closed
A5 January 2020Closed
B18 January 2021Closed
C1 February 2021Not Closed
D13 March 2021Not Closed

 

And if I select the date 4 July 2021, I want to see the following result:

ProjectEnd DateClosed or Not Closed
A5 January 2020Closed
B18 January 2021Closed
C1 February 2021Closed
D13 March 2021Closed


I tried the following measure but it does not work good:

ProjectStatus =
VAR SelectedDate = SELECTEDVALUE(Calender[Date])
VAR ClosedOrNot=
       IF(MAX(Projects[end_date]) > SelectedDate, "Not Closed", "Closed")
RETURN
       ClosedOrNot
 
Does someone know a solution?
1 ACCEPTED SOLUTION
pranit828
Community Champion
Community Champion

HI @Gjakova 

try the below code 

ProjectStatus =
VAR SelectedDate = SELECTEDVALUE(Calender[Date])
VAR ClosedOrNot=
       IF(CALCULATE(MAX(Projects[end_date]), ALLEXCEPT(Projects,Projects[Project])) > SelectedDate, "Niet Closed", "Closed")
RETURN
       ClosedOrNot




PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile

View solution in original post

2 REPLIES 2
pranit828
Community Champion
Community Champion

HI @Gjakova 

try the below code 

ProjectStatus =
VAR SelectedDate = SELECTEDVALUE(Calender[Date])
VAR ClosedOrNot=
       IF(CALCULATE(MAX(Projects[end_date]), ALLEXCEPT(Projects,Projects[Project])) > SelectedDate, "Niet Closed", "Closed")
RETURN
       ClosedOrNot




PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile

Thanks so much! That seems to work. Could you perhaps explain your measure/solution so I can understand it better for the future?

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors