Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Latest Value

Hi Guys,

 

I need some help on this. Here's my data:

DateStoreProductAnswer
16/07/2018McDonaldPizzaYes
17/07/2018McDonaldPizzaNo
16/07/2018McDonaldBurgerNo
17/07/2018McDonaldBurgerNo
16/07/2018KFCPizzaYes
17/07/2018KFCPizzaYes
16/07/2018KFCBurgerNo
17/07/2018KFCBurgerYes

 

I need to always get the Answer for latest Date. Here what result should be:

DateStoreProductAnswer
17/07/2018McDonaldPizzaNo
17/07/2018McDonaldBurgerNo
17/07/2018KFCPizzaYes
17/07/2018KFCBurgerYes

 

1. Can you please tell me the DAX formula to create above table?

 

2. Can you please tell me what should be the Measure for using Answer in a visualisation?

 

Thanks in advance.

Rob

  • Anonymous

     

    As a NEW Table ("Calculated Table"), you can use

     

    New Table =
    VAR temp =
        ADDCOLUMNS (
            Table1,
            "RANK", RANKX ( FILTER ( Table1, [Store] = EARLIER ( [Store] ) ), [Date],, DESC, DENSE )
        )
    RETURN
        FILTER ( temp, [RANK] = 1 )

5 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Ashish,

       

      Thanks for your help.

       

      However, I need a measure that will display the value for Answer in any visualisation. Is that possible?

       

      And/or create a new table in DAX that filters the below data only:

      DateStoreProductAnswer
      17/07/2018McDonaldPizzaNo
      17/07/2018McDonaldBurgerNo
      17/07/2018KFCPizzaYes
      17/07/2018KFCBurgerYes

       

      Thanks

      • Ashish_Mathur's avatar
        Ashish_Mathur
        Super User

        Hi,

         

        That is what my solution does.  Perhaps i do not understand your requirement.