cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Regular Visitor

Date Evaluation based on Project Name - DAX

Hi All,

 

I was not sure how to create or go about this equation. So I have a dataset that contains 3 columns: Project Name, Date, and Open/Closed. I am trying to create the formula for the "Open/Closed" column. I need to create an if statment that would return a value of open or closed. It would look a the date and see if it was the max date with in that project and if it was the max date in that project then it would say "Open" else "Closed". 

 

 

Project NameDateOpen/Closed
Project 11/20/21Open

Project 1

1/19/21Closed
Project 11/18/21Closed
Project 21/5/21

Open

Project 21/5/21

Open

Project 2

1/4/21Closed
2 ACCEPTED SOLUTIONS
Super User III
Super User III

@maustin02 add new column with this expression:

 

Open/Close = 
VAR __maxDate = CALCULATE ( MAX ( 'Table'[Date] ), ALLEXCEPT ( 'Table', 'Table'[Project Name] ) )
RETURN
IF ( 'Table'[Date] = __maxDate, "Open", "Closed" )

 

Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.






Did I answer your question? Mark my post as a solution.

Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.





View solution in original post

Community Support
Community Support

Hi , @maustin02 

You can also try function 'EARLIER '  in  a calculated column.

Calculated column = 
VAR __maxDate =
    CALCULATE (
        MAX ( 'Table'[Date] ),
        'Table',
        'Table'[Project Name] = EARLIER ( 'Table'[Project Name] )
    )
RETURN
    IF ( 'Table'[Date] = __maxDate, "Open", "Closed" )

If you want to create a  measure ,try formula as below:

Measure1 = 
VAR _max =
    CALCULATE (
        MAX ( 'Table'[Date] ),
        ALLEXCEPT ( 'Table', 'Table'[Project Name] )
    )
RETURN
    IF ( SELECTEDVALUE ( 'Table'[Date] ) = _max, "Open", "Closed" )

Best Regards,
Community Support Team _ Eason

View solution in original post

2 REPLIES 2
Community Support
Community Support

Hi , @maustin02 

You can also try function 'EARLIER '  in  a calculated column.

Calculated column = 
VAR __maxDate =
    CALCULATE (
        MAX ( 'Table'[Date] ),
        'Table',
        'Table'[Project Name] = EARLIER ( 'Table'[Project Name] )
    )
RETURN
    IF ( 'Table'[Date] = __maxDate, "Open", "Closed" )

If you want to create a  measure ,try formula as below:

Measure1 = 
VAR _max =
    CALCULATE (
        MAX ( 'Table'[Date] ),
        ALLEXCEPT ( 'Table', 'Table'[Project Name] )
    )
RETURN
    IF ( SELECTEDVALUE ( 'Table'[Date] ) = _max, "Open", "Closed" )

Best Regards,
Community Support Team _ Eason

View solution in original post

Super User III
Super User III

@maustin02 add new column with this expression:

 

Open/Close = 
VAR __maxDate = CALCULATE ( MAX ( 'Table'[Date] ), ALLEXCEPT ( 'Table', 'Table'[Project Name] ) )
RETURN
IF ( 'Table'[Date] = __maxDate, "Open", "Closed" )

 

Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.






Did I answer your question? Mark my post as a solution.

Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.





View solution in original post

Helpful resources

Announcements
secondImage

Congratulations!

We are excited to announce the Power BI Super Users!

Wave Release 2

Check out the updates in Power BI.

Overview of Power BI 2020 release wave 2!

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors