I need help with a DAX calculation. I have a table AppStages which lists the different AppID’s, Stage Name and the Completion Date. The users want to have a filter on the Completion Date such that only the latest Stage of an AppID is shown on the visual.
Example: Consider I have AppID = 1, with Stage 1 completed on 1/1/2019, Stage 2 completed on 2/1/2019 and Stage 3 completed on 3/1/2019.
So when the user selects date range of 1/1/2019 - 31/1/2019 , only the latest Stage 3 should be considered. Right now it shows me all 3 which is not what I want.
I am attaching the pbix file I am working to demonstrate exactly what I am trying to achieve.
Thank you so much for the solution provided. It works well for Max date. What complicates it is when an Application has completed Stage 1 and Stage 2 on the same day , then in that case I need to consider the max completion datetime.
Also what I am actually trying to achieve is the column chart , where I have the stage on axis and the count of Application ID as the measure. Each of the AppID’s should appear just once based on the Max Stage they are at.
Thanks for the clarification. I’m working on the revised measures and making good progress, but need to call it a night. Hope to have a solution for you tomorrow.
Sorry - got swamped on a big project at work yesterday and ended up working really late, so didn’t have time to finish this one. Eager to get back to it today, and just need to debug the final portion of the revised measure.
OK, got it. In addition to the Max date measure discussed above (modified to use date and time, rather than just date per above), I created a second measure that basically replicates the table boxed in red below virtually, then runs a count of App ID by Stage Name on that virtual table:
Note that I could have combined the two variables by wrapping VAR 1 in the FILTER() statement in VAR 2. However, when working with more complex virtual table variables, I like to use a “mini-measure branching” approach to build the table sequentially, which makes it easier (for me, at least) to understand the logic and to debug.