Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

How to create table based on minimum date from other table

Hi Folks,

 

I want to create second table from first table using filters with dates and other variables as follows. How to create this ?

Follwowing is the expected table and original table

 

 Original Table 
  
       
 IndexCategoryValue_1Value_2Date 
 1A0.06          1.001/3/2019Minimum Date 
 2A-0.1          4.001/4/2019 
 3A0.03        58.001/5/2019 
 4A0.1        63.001/6/2019 
 5D0.02        64.261/3/2019 
 6D-0.02        62.971/4/2019 
 7D-0.09        57.311/5/2019 
 8D0.04        59.601/6/2019 
       
 DESIRED TABLE 
       
 IndexCategoryValue_1Value_2Date 
 1A0.06          1.001/3/2019 
 5D0.02          1.021/3/2019 
       
       
  • Anonymous 

     

    You may use the following DAX to add a calculated table.

    Table =
    FILTER (
        Table1,
        RANKX (
            FILTER ( Table1, Table1[Category] = EARLIER ( Table1[Category] ) ),
            Table1[Date],
            ,
            ASC,
            DENSE
        ) = 1
    )
    

     

5 Replies

  • Anonymous you don't need new table for this you can achieve this by measure, one thing is not clear from your exmple, why value_2 for D will be 1.02 instead of 64.26 from table A

    • Anonymous's avatar
      Anonymous
      Not applicable

      Yeah, it is 64.26. Actually, I want to utilize this table for joining purpose hence keeping it in the seperate table. How can I do it? 

      • v-chuncz-msft's avatar
        v-chuncz-msft
        Community Support

        Anonymous 

         

        You may use the following DAX to add a calculated table.

        Table =
        FILTER (
            Table1,
            RANKX (
                FILTER ( Table1, Table1[Category] = EARLIER ( Table1[Category] ) ),
                Table1[Date],
                ,
                ASC,
                DENSE
            ) = 1
        )
        

         

  • Anonymous's avatar
    Anonymous
    Not applicable

    go to ..> Model --> choose --> new table,

     

    As per your requirement, use the below formula to create a table.

     

    Table = CALENDAR(MIN('Earlier'[Date]), MAX('Earlier'[Date]) )