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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric 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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Top Solution Authors
Top Kudoed Authors