Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

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

  • Anonymous 

     

    Try this MEASURE

     

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

5 Replies

  • Zubair_Muhammad's avatar
    Zubair_Muhammad
    Community Champion

    Anonymous 

     

    Try this MEASURE

     

    =
    IF (
        SELECTEDVALUE ( TableName[Picking Date] )
            = CALCULATE (
                MIN ( TableName[Picking Date] ),
                VALUES ( TableName[Type] ),
                ALLSELECTED ( TableName )
            ),
        1,
        0
    )
    
    • Anonymous's avatar
      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?

       

       

      Best regards

      Timo

      • Zubair_Muhammad's avatar
        Zubair_Muhammad
        Community Champion

        Anonymous 

         

        Could you share your file. I will try to help

         

        Regards,

        Zubair