Forum Discussion

cruzp's avatar
cruzp
Helper V
2 years ago
Solved

Get recent date per stage

Hi, i am fairly amatuer to PBI.

 

End goal is to only show data for the most recent 'effective_to' (date) because some of the stages have multiple 'effective_to' dates.

 

Example:
Opportunity name 2 Week Sprint - National B was created 6/23/2017, stage name Initial Discussion, value $700,000 then got changed again for Initial Discussion on 7/14/2017, value $600,000.

Get only the recent dates per each stage so table would show for Initial Discussion on 7/14/2017, value $600,000 only.

Low Risk (signed, pending PO) on 9/8/2017.

Qualifying on 8/3/2017.

 

is that possible in DAX, how?

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi cruzp ,

     

    According to your description, here are my steps you can follow as a solution.

    (1) My test data is the same as yours.

    (2) We can create a measure. 

    Flag = 
    var _max= CALCULATE(LASTDATE('Table'[effective_to]),FILTER(ALLSELECTED('Table'),'Table'[Opportunity_name]=MAX('Table'[Opportunity_name]) && 'Table'[stage_name]=MAX('Table'[stage_name])))
    RETURN IF(MAX('Table'[effective_to])=_max,1,0)

    (3) Place [Flag=1] on visual object screening and then the result is as follows.

    Best Regards,

    Neeko Tang

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

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi cruzp ,

     

    According to your description, here are my steps you can follow as a solution.

    (1) My test data is the same as yours.

    (2) We can create a measure. 

    Flag = 
    var _max= CALCULATE(LASTDATE('Table'[effective_to]),FILTER(ALLSELECTED('Table'),'Table'[Opportunity_name]=MAX('Table'[Opportunity_name]) && 'Table'[stage_name]=MAX('Table'[stage_name])))
    RETURN IF(MAX('Table'[effective_to])=_max,1,0)

    (3) Place [Flag=1] on visual object screening and then the result is as follows.

    Best Regards,

    Neeko Tang

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