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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.