Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
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.
Solved! Go to Solution.
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!!!
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
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
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!!!
User | Count |
---|---|
140 | |
113 | |
104 | |
77 | |
65 |
User | Count |
---|---|
136 | |
118 | |
101 | |
71 | |
61 |