Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Sajeerahammed
Regular Visitor

V lookup in dax(Multiple ciriteria)

Dear All,

Im new to dax and I need Help on below topic.I need to bring customer name from first table to second table(Desired output)according to time and Salesman(Two cirterias).In first table time mentioned in time period and in second table its precise.

 

Table 1
CustomerSalesman NameStart TimeEnd Time
Carrefour City CentreSuraj04-11-2023, 08:38:25 AM04-11-2023, 08:38:41 AM
Carrefour City CentreSuraj04-11-2023, 08:38:41 AM04-11-2023, 08:42:38 AM
Carrefour City CentreSuraj04-11-2023, 08:42:38 AM04-11-2023, 08:42:48 AM
Carrefour City CentreSuraj04-11-2023, 08:42:48 AM04-11-2023, 09:18:20 AM
MONOPRIX SHOPSuraj04-11-2023, 09:18:20 AM04-11-2023, 09:18:33 AM
MONOPRIX SHOPSuraj04-11-2023, 09:18:33 AM04-11-2023, 09:34:57 AM
carrefour,landmarkRaja04-11-2023, 09:34:57 AM04-11-2023, 10:43:29 AM
carrefour,landmarkRaja04-11-2023, 10:43:29 AM04-11-2023, 10:43:40 AM
carrefour,landmarkRaja04-11-2023, 10:43:40 AM04-11-2023, 10:44:21 AM

 

 

Table 2
TimeSalesmanDesired output
04-11-2023, 08:50:07 AMSurajCarrefour City Centre
04-11-2023, 09:36:30 AMRajacarrefour,landmark
1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

Hi @Sajeerahammed ,

 

try to add a calculated column in table2 like:

Column = 
MAXX(
    FILTER(
        table1,
        Table1[Salesman Name]=Table2[Salesman]
            &&Table1[Start Time]<=Table2[Time]
            &&Table1[End Time]>=Table2[Time]
    ),
    Table1[Customer]
)

 

it worked like:

FreemanZ_0-1701595057174.png

 

View solution in original post

4 REPLIES 4
FreemanZ
Super User
Super User

Hi @Sajeerahammed ,

 

try to add a calculated column in table2 like:

Column = 
MAXX(
    FILTER(
        table1,
        Table1[Salesman Name]=Table2[Salesman]
            &&Table1[Start Time]<=Table2[Time]
            &&Table1[End Time]>=Table2[Time]
    ),
    Table1[Customer]
)

 

it worked like:

FreemanZ_0-1701595057174.png

 

thank you sir...Problem solved

kaisrec
Helper I
Helper I
Tom_Y
Helper II
Helper II

The question is why do you need a Table 2? All the information seems ready in Table 1 for presentation. You just need to categorize them in visual?

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors