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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
ayusharma
Frequent Visitor

Max and Min Value Changes with the change in Date range filter

Hi All,

i am trying to create a function that make change in max and min value with the change in date range filter , Data as follow:

 

VEHICLE NO.TAREDATE
UP85CT5461166304/9/2022 1:39
UP85CT5461165204/10/2022 5:10
UP85CT5461165104/11/2022 5:04
UP85CT5461165804/12/2022 5:07
UP85CT5461164904/13/2022 3:24
UP85CT5461165604/14/2022 2:15
UP85CT5461165304/15/2022 4:14

 

like when i select the date range in filter from 4/13/2022 to 4/15/2022 then max value = 16560 and min value = 16490 or 

same goes for date range in filter from 4/10/2022 to 4/11/2022 then max value = 16520 and min value = 16510

whenever i change the date range then it start showing the max and min value of that date range.

 

Please help me out about how to create that date range which pull the data from that particular range.

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

HI @ayusharma,

If you want to use the slicer to choose the date range instead of filter on your table records, I'd like to suggest you create an unconnected data table as the source of the slicer.
Then you can use this new date table to create a slicer with 'between' mode and write DAX formulas to get aggregated values:

 

Min TARE =
CALCULATE (
    MIN ( Table[TARE] ),
    FILTER ( ALLSELECTED ( Table ), [Date] IN ALLSELECTED ( Calendar[Date] ) ),
    VALUES ( Table[VEHICLE NO.] )
)

Max TARE =
CALCULATE (
    MAX ( Table[TARE] ),
    FILTER ( ALLSELECTED ( Table ), [Date] IN ALLSELECTED ( Calendar[Date] ) ),
    VALUES ( Table[VEHICLE NO.] )
)

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

5 REPLIES 5
v-shex-msft
Community Support
Community Support

HI @ayusharma,

If you want to use the slicer to choose the date range instead of filter on your table records, I'd like to suggest you create an unconnected data table as the source of the slicer.
Then you can use this new date table to create a slicer with 'between' mode and write DAX formulas to get aggregated values:

 

Min TARE =
CALCULATE (
    MIN ( Table[TARE] ),
    FILTER ( ALLSELECTED ( Table ), [Date] IN ALLSELECTED ( Calendar[Date] ) ),
    VALUES ( Table[VEHICLE NO.] )
)

Max TARE =
CALCULATE (
    MAX ( Table[TARE] ),
    FILTER ( ALLSELECTED ( Table ), [Date] IN ALLSELECTED ( Calendar[Date] ) ),
    VALUES ( Table[VEHICLE NO.] )
)

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

this solution work thanks 

ayusharma
Frequent Visitor

i come up with dax query for this problem where i used it in the measure column:

for this i make a early date and end date for this and compare it with date and vehicle no.

Max Tare Weight = Var Vehicle = Values('Sheet1 (2)'[VEHICLE NO.])
Var starDate = 'Sheet1 (2)'[Start Date]
Var EndDate = [Last Date]
Return
(Maxx(FILTER(ALL('Sheet1 (2)'),'Sheet1 (2)'[DATE]<=EndDate && 'Sheet1 (2)'[DATE]>=starDate &&'Sheet1 (2)'[VEHICLE NO.]=Vehicle ),'Sheet1 (2)'[TARE]))
ayusharma
Frequent Visitor

this not what i looking for , i want max and min changes according to the date dail filter and the method that you suggested only showing one value , please help

selimovd
Super User
Super User

Hey @ayusharma ,

 

use a slicer to filter your date range.

Then you can create a measure to create the MAX and the MIN value:

Max Value = MAX( myTable[myValue] )

 

Min Value = MIN( myTable[myValue] )

 

The measure will calculate depending on your slicer selection.

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍

Best regards
Denis

Blog: WhatTheFact.bi
Follow me: twitter.com/DenSelimovic

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.