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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
komald
Helper I
Helper I

How to get minimum or first customer order date for different range of dates

I want to get minimum customer order date between  date range , if change date range then i should get minmum order date date between that range. 
for the reference please refer ss.

komald_1-1649252687664.png

i have used date slicer if i change date range i should get minimum to large date in that table for that particular date range and i want to add column which shows the is this minimum date or not for that particular range in the form of "Yes" and "No"

for example: my date range is 21 jan 2020 - 31 dec 2021
and in table im having dates like order dates like 
23 jan 2020
26 jan 2020

28 jan 2020
30 dec 2021
....
so here my min date is 23 jan 2020 so i need to comapre this date with this column itself if it is matching i want "Yes" in next column otherwise "No" .

and this should be run as per change in date range

 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @komald 

you can try

Is First Order =
VAR CurrentDateInFilter =
    SELECTEDVALUE ( Table[FactSales Posting Date] )
VAR FirstSelectedDate =
    CALCULATE (
        MIN ( Table[FactSales Posting Date] ),
        REMOVEFILTERS (),
        ALLSELECTED ( Table[FactSales Posting Date] )
    )
VAR LastSelectedDate =
    CALCULATE (
        MAX ( Table[FactSales Posting Date] ),
        REMOVEFILTERS (),
        ALLSELECTED ( Table[FactSales Posting Date] )
    )
VAR FirstOrderDate =
    CALCULATE (
        MIN ( Table[FactSales Posting Date] ),
        Table[FactSales Posting Date] > FirstSelectedDate,
        Table[FactSales Posting Date] < LastSelectedDate
    )
RETURN
    IF ( CurrentDateInFilter = FirstOrderDate, "Yes", "No" )

 

View solution in original post

1 REPLY 1
tamerj1
Super User
Super User

Hi @komald 

you can try

Is First Order =
VAR CurrentDateInFilter =
    SELECTEDVALUE ( Table[FactSales Posting Date] )
VAR FirstSelectedDate =
    CALCULATE (
        MIN ( Table[FactSales Posting Date] ),
        REMOVEFILTERS (),
        ALLSELECTED ( Table[FactSales Posting Date] )
    )
VAR LastSelectedDate =
    CALCULATE (
        MAX ( Table[FactSales Posting Date] ),
        REMOVEFILTERS (),
        ALLSELECTED ( Table[FactSales Posting Date] )
    )
VAR FirstOrderDate =
    CALCULATE (
        MIN ( Table[FactSales Posting Date] ),
        Table[FactSales Posting Date] > FirstSelectedDate,
        Table[FactSales Posting Date] < LastSelectedDate
    )
RETURN
    IF ( CurrentDateInFilter = FirstOrderDate, "Yes", "No" )

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.