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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
JL0101
Helper I
Helper I

How do I compare 1 date with several dates in 2 tables to find the minimum

 

The goal is to categories table 1 with the the dates of table 2 by whichever date is closer in table 2. How can this be achieved in power query? I have provided the Dax script below.

 

Table 1: model with version

Model Version Number

 
 
EI117/01/2023
EI119/01/2023
EI128/01/2023
EI102/02/2023
EI205/02/2023
EI226/02/2023
EI204/03/2023
EI208/03/2023

 

Table 2: Dates

Date

13/01/23
27/01/23
10/02/23
24/02/23
07/03/23
21/03/23
05/04/23

 

For example

 

Table 3: model with version categorized

 

EI117/01/2023 27/01/23
EI119/01/2023 27/01/23
EI128/01/2023 10/02/23
EI102/02/2023 10/02/23
EI205/02/2023 10/02/23
EI226/02/2023 07/03/23
EI204/03/2023 07/03/23

 

etc...

 

Below is the Code that works how can I write it in power query?

 

DateAg = CALCULATE ( MIN ( 'Date'[DateList]), FILTER ( 'Date', 'Date'[DateList] >= 'EI'[Version] ) )

1 ACCEPTED SOLUTION
Payeras_BI
Super User
Super User

Hi @JL0101 ,

A possible solution:

Payeras_BI_0-1683648054183.png

Make sure both Version and DateList columns are set to type date.

 

If this post answered your question, please mark it as a solution to help other users find useful content.
Kudos are another nice way to acknowledge those who tried to help you.

J. Payeras
Mallorca, Spain

View solution in original post

2 REPLIES 2
JL0101
Helper I
Helper I

Perfect, thank you!

Payeras_BI
Super User
Super User

Hi @JL0101 ,

A possible solution:

Payeras_BI_0-1683648054183.png

Make sure both Version and DateList columns are set to type date.

 

If this post answered your question, please mark it as a solution to help other users find useful content.
Kudos are another nice way to acknowledge those who tried to help you.

J. Payeras
Mallorca, Spain

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors