Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Not Started, Completed, In Progress based on Dates

Hi,

 

I am trying to give status to my progect activities based on Slicer Date:

 

 

 




Measure =
VAR slicer = [SELECTED VALUE]
return
IF('Activities'[PlannedStart] < slicer,"Not Started", IF(slicer > 'Activities'[PlannedFinish], "Completed" , "In Progress"))

But the IF Condition is not taking the Start and Finish Date, it is giving error
 
 

 

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi  Anonymous ,

    The Max()/Min() functions express different meanings in calculated and measure, for example:

    1. Using the Max() function in calculated is to take the maximum value of this column, see the result below

    max_measure = MAX('Activity'[planned finish])

    [planned finish] The largest date in the column is 2024.10.9

    2. Use the max() function in measure to take the value of the current row.

    max_measure = MAX('Activity'[planned finish])

    Take out the current value of each row

    So use the following function according to your rules, you can compare the value in the slicer with each Activity in the table row by row and compare the start and finish dates of each activity

    Measure 2 =
    var _select =SELECTEDVALUE('Table'[Date])
    return
    IF(MAX('Activity'[planned start]) <_select,"Not Started", IF(_select > MAX('Activity'[planned finish]), "Completed" , "In Progress"))

    Best Regards,

    Liu Yang

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

7 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Anonymous 

    Measure =
    VAR slicer = [SELECTED VALUE]
    return
    IF(MAX('Activities'[PlannedStart]) < slicer,"Not Started", IF(slicer > MAX('Activities'[PlannedFinish]), "Completed" , "In Progress"))
    • Anonymous's avatar
      Anonymous
      Not applicable

      Greg_Deckler , I did try the Min and Max but it is not giving correct answer, as we want to go row by row for every activity in the table and compare the start finish date for each, and not pick Max or Min date from the Column

  • Anonymous You need to use some aggregated function with that like MAX etc.

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  Anonymous ,

    The Max()/Min() functions express different meanings in calculated and measure, for example:

    1. Using the Max() function in calculated is to take the maximum value of this column, see the result below

    max_measure = MAX('Activity'[planned finish])

    [planned finish] The largest date in the column is 2024.10.9

    2. Use the max() function in measure to take the value of the current row.

    max_measure = MAX('Activity'[planned finish])

    Take out the current value of each row

    So use the following function according to your rules, you can compare the value in the slicer with each Activity in the table row by row and compare the start and finish dates of each activity

    Measure 2 =
    var _select =SELECTEDVALUE('Table'[Date])
    return
    IF(MAX('Activity'[planned start]) <_select,"Not Started", IF(_select > MAX('Activity'[planned finish]), "Completed" , "In Progress"))

    Best Regards,

    Liu Yang

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

    • Anonymous's avatar
      Anonymous
      Not applicable

      This gave me a partial solution. and Thank you for explaining the concept as well