Skip to main content
cancel
Showing results for 
Search instead 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

Reply
zorrro
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 : 

ARTDateValue
refe128/11/2022 
refe129/11/2022 
refe130/11/2022 
refe228/11/2022 
refe230/11/2022 

 

Table Y : 

ARTDate ADate B
refe128/11/202230/11/2022
refe101/12/202204/12/2022
refe228/11/202230/11/2022
refe201/12/202204/12/2022

 

I tried : 

 

MINX(

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

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

)

 

Thank you for your help

1 ACCEPTED SOLUTION

Hi, @zorrro 

Please try formula like:

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

Your expected result seems to have wrong value, please check again.

Result:

veasonfmsft_0-1670233671013.png

Best Regards,
Community Support Team _ Eason

View solution in original post

10 REPLIES 10
Mahesh0016
Super User
Super User

Mahesh0016_0-1669981497300.png

 

Mahesh0016
Super User
Super User

Mahesh0016_1-1669981378621.png

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]))

 

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 : 

 

zorrro_0-1669985727712.png

Thanks for your hepl

Hi, @zorrro 

Please try formula like:

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

Your expected result seems to have wrong value, please check again.

Result:

veasonfmsft_0-1670233671013.png

Best Regards,
Community Support Team _ Eason

zorrro
Frequent Visitor

TableX: 

ARTDate

Value

refe128/11/2022

3

refe129/11/2022

5

refe130/11/2022

6

refe101/12/2022

7

refe102/12/2022

9

refe103/12/2022

5

refe104/12/2022

8

refe228/11/2022

4

refe230/11/2022

7

refe202/12/2022

10

refe203/12/2022

17

 

TableY: 

ARTDate ADate B

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

NikhilChenna
Continued Contributor
Continued Contributor

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

 

 

@NikhilChenna 

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

Thanks

 

 

v-easonf-msft
Community Support
Community Support

Hi, @zorrro 

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

Can you share your expected output to further explain your requirement?

Best Regards,
Community Support Team _ Eason

 

@v-easonf-msft 

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

Thanks

TableX: 

ARTDate

Value

refe128/11/2022

3

refe129/11/2022

5

refe130/11/2022

6

refe101/12/2022

7

refe102/12/2022

9

refe103/12/2022

5

refe104/12/2022

8

refe228/11/2022

4

refe230/11/2022

7

refe202/12/2022

10

refe203/12/2022

17

 

TableY: 

ARTDate ADate B

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

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.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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