Forum Discussion

michael_knight's avatar
michael_knight
Post Prodigy
5 years ago
Solved

Distinct Count displaying earliest

Hi,

 

I want to create a column which displays the earliest occurance of a record. I've made a small sample data below of what it should look like. I created it on Excel and it's the First column which I want to recreate in Power BI 

 

https://www.dropbox.com/s/4pbc79tpo9yg59a/help.pbix?dl=0

 

Any help will be greatful

 

Cheers,

Mike

2 Replies

  • michael_knight , Create a new column like

    if([created on] = minx(filter(Table, [email] = earlier([email])), [created on]), "Yes", blank())

  • v-kelly-msft's avatar
    v-kelly-msft
    Community Support

    Hi  michael_knight ,

     

    Create a new column as below:

    Column = 
    var _earliestdate=CALCULATE(MIN('Sheet1'[CreatedOn]),FILTER('Sheet1','Sheet1'[Email]=EARLIER(Sheet1[Email])))
    Return
    IF('Sheet1'[CreatedOn]=_earliestdate,"Yes",BLANK()) 

    Or a measure as below:

    Measure = 
    var _earliestdate=CALCULATE(MIN('Sheet1'[CreatedOn]),FILTER(ALL('Sheet1'),'Sheet1'[Email]=MAX(Sheet1[Email])))
    Return
    IF(MAX('Sheet1'[CreatedOn])=_earliestdate,"Yes",BLANK()) 

    And you will see:

     

    For the related .pbix file,pls see attached.

     

    Best Regards,
    Kelly

    Did I answer your question? Mark my post as a solution!