Forum Discussion

kwonsok's avatar
kwonsok
Frequent Visitor
7 years ago
Solved

LOD Expressions from Tableau

Hi,

 

I am trying to calculate the first purchase date of a given customer.

 

 

 

Each row has a customer ID and a purchase date, leading two a structure with multiple rows that have the same customer ID with different purchase dates.

 

In Tableau, I used the "Fixed" function, but this function does not seem to exist in Power BI.

 

I've also tried what this post mentions, but the expression used in this post returns the first purchase date for ALL customer ID's for me.

 

https://dataveld.com/2018/02/17/tableau-to-power-bi-fixed-lod-expressions/

 

Any help would be appreciated.

 

Thanks.

  • Hi kwonsok,

    You can use the below DAX statement in a calculated column for achieving your need. (You can modify this DAX as per your need)

     

    Column = CALCULATE(MIN('Table1'[Datetime]), FILTER('Table1', 'Table1'[ID] = EARLIER('Table1'[ID])))

     

     

     

    The Above Screenshot shows the value after using DAX statement in the "Column" column values

    Hope this helps!!!

3 Replies

  • Hi kwonsok,

    You can use the below DAX statement in a calculated column for achieving your need. (You can modify this DAX as per your need)

     

    Column = CALCULATE(MIN('Table1'[Datetime]), FILTER('Table1', 'Table1'[ID] = EARLIER('Table1'[ID])))

     

     

     

    The Above Screenshot shows the value after using DAX statement in the "Column" column values

    Hope this helps!!!

  • v-danhe-msft's avatar
    v-danhe-msft
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi kwonsok,

    Could you please tell me if your problem has been solved? If it is, could you please mark the helpful replies as Answered?

     

    Regards,

    Daniel He

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi this is very helpful,

       

      but is there a way to show distinct values, I am trying to do something similar to this function but i need to sum the distinct values.

       

      for example my data set looks like this

       

      ID User Count    items

      1     100               A

      1     100               B

      1     100               C

      1     100               D

       

      I need the formula to output

      ID User Count

      1     100

       

      and so on for all of the IDs