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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
)

Regards
Zubair

Please try my custom visuals

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
)

Regards
Zubair

Please try my custom visuals
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


Regards
Zubair

Please try my custom visuals
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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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