Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Lookup lowest date

I have two tables, 1 where the user submits their ISP information and there can be multiple entries if they change the speed, provider, sometimes they upload a new record monthly, and another table where they submit any downtime they have during their working hours.

Now I want to know the ISP associated with the downtime, the two tables are something like:

 

TABLE 1

 

AGENT IDISPDate
1Provider 19/1/21
1Provider 210/17/21

 

TABLE 2

 

AGENT IDDOWNTIME DATEREASONISP Lookup
19/5/21Internet Issues 
19/20/21Internet Issues 
110/1/21Internet Issues 
110/31/21Internet Issues 
111/5/21Internet Issues 
112/12/21Internet Issues 
112/13/21Internet Issues 

 

I want to make a Lookup that finds the ISP based on the lowest date, In this example, everything before 10/17/21 should go under provider 1 and everything after 10/17/21 should be under provider 2

I'm having issues getting the date match, can you help me with this?

  • Hi Anonymous 

     

    Try this code to add a new column with DAX = 

    ISP Lookup =
    CALCULATE (
        MAX ( 'Table 1'[ISP] ),
        FILTER ( 'Table 1', 'Table 1'[Date] <= EARLIER ( 'Table 2'[DOWNTIME DATE] ) )
    )

     

    output:

     

     

     

     

     

    If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
    Appreciate your Kudos!!
    LinkedIn: 
    www.linkedin.com/in/vahid-dm/

     

     

2 Replies

  • Hi Anonymous 

     

    Try this code to add a new column with DAX = 

    ISP Lookup =
    CALCULATE (
        MAX ( 'Table 1'[ISP] ),
        FILTER ( 'Table 1', 'Table 1'[Date] <= EARLIER ( 'Table 2'[DOWNTIME DATE] ) )
    )

     

    output:

     

     

     

     

     

    If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
    Appreciate your Kudos!!
    LinkedIn: 
    www.linkedin.com/in/vahid-dm/

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      thanks, you are a genius !!