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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

EARLIER functionality in Measure

Hi,

 

I need a Measure which contains the EARLIER functionality.

 

My Table

IDTypeFieldCustomerPicking DateBest before
1BananaAX01.01.201901.02.2019
2AppleAY01.02.201901.03.2019
3BananaBX01.03.201901.04.2019
4BananaAY01.05.201901.06.2019
5AppleBX01.03.201901.04.2019

 

To find the first Picking Date by Type a add a Column and use the Earlier function and mark it with "1".

IDTypeFieldCustomerPicking DateBest beforeColumn
1BananaAX01.01.201901.02.20191
2AppleAY01.02.201901.03.20191
3BananaBX01.03.201901.04.20190
4BananaAY01.05.201901.06.20190
5AppleBX01.03.201901.04.20190

 

But now I want to filter by Customer and find the first picking dates (depending on the type)

 

IDTypeFieldCustomerPicking DateBest beforeMeasure?
1BananaAX01.01.201901.02.20191
3BananaBX01.03.201901.04.20190
5AppleBX01.03.201901.04.20191

 

So I can't use the column. So I think I need a Measure right? But the Earlier function don't work in a measure. Has anyone an idea?

 

I always want to find the first picking date depending on the type. If I select a second filter (e.g. field) I still want to mark the first picking dates

 

IDTypeFieldCustomerPicking DateBest beforeMeasure
3BananaBX01.03.201901.04.20191
5AppleBX01.03.201901.04.20191

 

Best regards

Timo

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

@Anonymous 

 

Try this MEASURE

 

=
IF (
    SELECTEDVALUE ( TableName[Picking Date] )
        = CALCULATE (
            MIN ( TableName[Picking Date] ),
            VALUES ( TableName[Type] ),
            ALLSELECTED ( TableName )
        ),
    1,
    0
)

View solution in original post

5 REPLIES 5
Zubair_Muhammad
Community Champion
Community Champion

@Anonymous 

 

Try this MEASURE

 

=
IF (
    SELECTEDVALUE ( TableName[Picking Date] )
        = CALCULATE (
            MIN ( TableName[Picking Date] ),
            VALUES ( TableName[Type] ),
            ALLSELECTED ( TableName )
        ),
    1,
    0
)
Anonymous
Not applicable

Hi @Zubair_Muhammad ,

 

many thanks for your fast reply and your solution.

First of all the measure works fine. Thank you.

But my column chart don't. Do you know why?

 

SOP.PNG

 

Best regards

Timo

@Anonymous 

 

Could you share your file. I will try to help

 

Regards,

Zubair

Anonymous
Not applicable

@Zubair_Muhammad 

 

Sorry but because of our directives I am not able to upload my file.

 

It is a stacked column chart.

Axis is "Best before" with Hierarchy year and month and the value is Measure. With a (sum) column in the chart it works fine. So I think there is the problem, but I am not able to sum the measure.

Anonymous
Not applicable

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.