cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Frequent Visitor

## minimum value between 2 dates

Hello,

I want to calcule a minimum and maximum for value that i have in table X. But i want to have the minimum and maximum between 2 dates that i have in table Y.

Exemple :

Table X :

 ART Date Value refe1 28/11/2022 refe1 29/11/2022 refe1 30/11/2022 refe2 28/11/2022 refe2 30/11/2022

Table Y :

 ART Date A Date B refe1 28/11/2022 30/11/2022 refe1 01/12/2022 04/12/2022 refe2 28/11/2022 30/11/2022 refe2 01/12/2022 04/12/2022

I tried :

MINX(

KEEPFILTERS(DATESBETWEEN('TableX'[dateFormatted],'TableY'[DATE A],'CBANOQ1'[DATE B])),

CALCULATE(SUM('TableX'[Value]))

)

1 ACCEPTED SOLUTION
Community Support

Hi, @zorrro

``````minimum =
CALCULATE (
MIN ( TableX[Value] ),
FILTER (
TableX,
TableX[ART] = SELECTEDVALUE ( TableY[ART] )
&& TableX[Date] >= SELECTEDVALUE ( TableY[Date A] )
&& TableX[Date] <= SELECTEDVALUE ( TableY[Date B] )
)
)
``````

Result:

Best Regards,
Community Support Team _ Eason

10 REPLIES 10
Super User

Super User

MaxValue = CALCULATE(MAX(X[Value]),DATEDIFF(Y[Date A],Y[Date B],DAY),ALLEXCEPT(X,X[ART]))
MinValue = CALCULATE(MIN(X[Value]),DATEDIFF(Y[Date A],Y[Date B],DAY),ALLEXCEPT(X,X[ART]))

Frequent Visitor

Hello,

I tried your suggestion but it's donesn't work.

I add a exemple in the tables just to be more specific for the result that i want :

Community Support

Hi, @zorrro

``````minimum =
CALCULATE (
MIN ( TableX[Value] ),
FILTER (
TableX,
TableX[ART] = SELECTEDVALUE ( TableY[ART] )
&& TableX[Date] >= SELECTEDVALUE ( TableY[Date A] )
&& TableX[Date] <= SELECTEDVALUE ( TableY[Date B] )
)
)
``````

Result:

Best Regards,
Community Support Team _ Eason

Frequent Visitor

TableX:

ARTDate

refe128/11/2022

refe129/11/2022

refe130/11/2022

refe101/12/2022

refe102/12/2022

refe103/12/2022

refe104/12/2022

refe228/11/2022

refe230/11/2022

refe202/12/2022

refe203/12/2022

TableY:

# output

refe128/11/202230/11/2022

# 3

refe101/12/202204/12/2022

# 5

refe229/11/202230/11/2022

# 4

refe202/12/202203/12/2022

# 10

Continued Contributor

Hi @zorrro , Can you share the expected output result too.

Frequent Visitor

Hello, I shared the expected output. Can you check and give me your opinion ?

Thanks

Community Support

Hi， @zorrro

The fields in your formula don't seem to match the fields in your table.

Best Regards,
Community Support Team _ Eason

Frequent Visitor

Hello, I shared the expected output. Can you check and give me your opinion ?

Thanks

Frequent Visitor

TableX:

ARTDate

refe128/11/2022

refe129/11/2022

refe130/11/2022

refe101/12/2022

refe102/12/2022

refe103/12/2022

refe104/12/2022

refe228/11/2022

refe230/11/2022

refe202/12/2022

refe203/12/2022

TableY:

# output

refe128/11/202230/11/2022

# 3

refe101/12/202204/12/2022

# 5

refe229/11/202230/11/2022

# 4

refe202/12/202203/12/2022

# 10

Announcements

#### 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.

#### Power BI Monthly Update - June 2024

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

#### New forum boards available in Real-Time Intelligence.

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

Top Solution Authors
Top Kudoed Authors