Forum Discussion

prabhatnath's avatar
prabhatnath
Advocate III
3 years ago
Solved

Need Help in Dax for Measures

Hello Friends,

 

I am new to Power BI and looking for help in building 3 measures and having below data:

ProjectSprint NameWork ItemTitleStatusTypeStart DateEnd Date
Project-ABacklog1001Title-1NewUser Story9/12/2022 12:00:00 AM9/24/2022 12:00:00 AM
Project-ABacklog1002Title-2NewUser Story9/12/2022 12:00:00 AM9/24/2022 12:00:00 AM
Project-ASprint 121003Title-3NewUser Story6/5/2023 12:00:00 AM6/17/2023 12:00:00 AM
Project-ASprint 121004Title-4NewUser Story6/5/2023 12:00:00 AM6/17/2023 12:00:00 AM
Project-ASprint 121005Title-5NewUser Story6/5/2023 12:00:00 AM6/17/2023 12:00:00 AM
Project-ASprint 131006Title-6NewUser Story6/19/2023 12:00:00 AM7/1/2023 12:00:00 AM
Project-ASprint 131007Title-7NewUser Story6/19/2023 12:00:00 AM7/1/2023 12:00:00 AM
Project-ASprint 131008Title-8NewUser Story6/19/2023 12:00:00 AM7/1/2023 12:00:00 AM
Project-ASprint 131009Title-9NewUser Story6/19/2023 12:00:00 AM7/1/2023 12:00:00 AM
Project-BSprint 10021010Title-10NewUser Story6/5/2023 12:00:00 AM6/17/2023 12:00:00 AM
Project-BSprint 10021011Title-11NewUser Story6/5/2023 12:00:00 AM6/17/2023 12:00:00 AM
Project-BSprint 10031012Title-12NewUser Story6/19/2023 12:00:00 AM7/1/2023 12:00:00 AM

 

I need help with 3 Measures:

1) Measure to find the Start Date of the Sprint in the Project
Results:
Project-A, Backlog Sprint = 9/12/2022,
Project-A, Sprint 12 = 6/5/2023,

Project-A, Sprint 13 = 6/19/2023,

 

2) Measure to find the End Date of the Sprint in the Project

Results:
Project-A, Backlog Sprint = 9/24/2022,
Project-A, Sprint 12 = 6/17/2023,

Project-A, Sprint 13 = 7/1/2023,

 

3) Measure to Find the Current Sprint of the Project (Sprint range that falls in the current date = 6/19/2023) 

Result:
Project-A = Sprint 12

Project-B = Sprint 1003

 

Thank you in advance for your help.

Prabhat

  • Hi,

     

    before you start make sure your date fields are in a date format then try these:

     

    1)Start of Sprint = CALCULATE(MIN('Table'[Start Date]),ALLEXCEPT('Table','Table'[Sprint Name]))

     

    2)End of Sprint = CALCULATE(MAX('Table'[End Date]),ALLEXCEPT('Table','Table'[Sprint Name]))

     

    3) Current Sprint = if(and([Start of Sprint] <= TODAY(),

         [End of Sprint]   >= TODAY()),1,0)
     
    the first 2 will give you fields you can just add to a table:
     

     

    the 3rd measure will give you a 1 or 0, use this as a filter on a separate table visual to only display the records equal to 1:

     

     

    If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

1 Reply

  • DOLEARY85's avatar
    DOLEARY85
    Resident Rockstar

    Hi,

     

    before you start make sure your date fields are in a date format then try these:

     

    1)Start of Sprint = CALCULATE(MIN('Table'[Start Date]),ALLEXCEPT('Table','Table'[Sprint Name]))

     

    2)End of Sprint = CALCULATE(MAX('Table'[End Date]),ALLEXCEPT('Table','Table'[Sprint Name]))

     

    3) Current Sprint = if(and([Start of Sprint] <= TODAY(),

         [End of Sprint]   >= TODAY()),1,0)
     
    the first 2 will give you fields you can just add to a table:
     

     

    the 3rd measure will give you a 1 or 0, use this as a filter on a separate table visual to only display the records equal to 1:

     

     

    If I answered your question, please mark my post as solution, Appreciate your Kudos 👍