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.
Hi,
The data consists of customer transactions.
For each row:
Else:
This date should be stored in a new column called "previous_date" of the same row.
It seemed complicated to implement, any way this is possible?
You can find the sample data set here: Sample Dataset
Thanks!
Solved! Go to Solution.
Hi,
Try this calculated column formula
=CALCULATE(MAX(Data[Date of Disbursement]),FILTER(Data,Data[Member Code]=EARLIER(Data[Member Code])&&Data[Date of Disbursement]<EARLIER(Data[Date of Disbursement])))
Hope this helps.
re
Hi,
Try this calculated column formula
Previos date = if(CALCULATE(MAX(Data[Date]),FILTER(Data,Data[Customer Id]=EARLIER(Data[Customer Id])&&Data[Date]<EARLIER(Data[Date])))=CALCULATE(min(Data[Date]),FILTER(Data,Data[Customer Id]=EARLIER(Data[Customer Id])&&Data[Date]<EARLIER(Data[Date]))),BLANK(),CALCULATE(MAX(Data[Date]),FILTER(Data,Data[Customer Id]=EARLIER(Data[Customer Id])&&Data[Date]<EARLIER(Data[Date]))))
Hope this helps.
Hi Ashish,
Thanks for reverting.
I tried out your solution but the result consist of blank() only.
Can you try it out on the sample data whether its working for you?
Hi,
It works fine - some entries in that column are blank but a lot are filled up. You may download my PBI file from here.
Hope this helps.
For some reason, I only get blanks when I replicate the formula for my use case. Can't figure out why.
I've stripped down my actual data with actual coulmn names in this pbix. The formula you provided is also implemented.
Please review.
Thanks
Hi,
There is no mistake with your formula. Looks like the data is such that the prior date for every Member Code is also the first date for that customer code so that is why you see a blank.
Hi,
Many customers have only one record, but there are thousands of other customers who appear twice at max. So atleast for the second appearance their previous date should be there.
I just checked. The maximum number of times any Material Code appears is 2. So my statement above is correct and the formula should return blanks for all Material codes.
So, for customers who appear twice at max, the result in the previous date column should be blank because the previous date will be the first date. There can be an entry in the earlier date column only when there are more than 2 entries for that customer.
Oh, the use case that I have requires the previous date even if there is only one record above it.
Any possible work around for this?
This is extremenly confusing and absolutely not what you stated in the original post. If you want my help, share a small simple exampel and show the expected result for that simple example.
Sorry about the confusion.
Here is a sample explanation:
The repeated customers are highlighted with a unique colour for each.
When the customer appeared for the second time, his previous date of occurence is stored in the 'Previous Date' column.
Else it will always be blank.
In the original post too, I meant that the first occurence should have the new column as blank, the rest should have the previous occurence date in the the new column, just mentioned it the other way around.
Hi,
Try this calculated column formula
=CALCULATE(MAX(Data[Date of Disbursement]),FILTER(Data,Data[Member Code]=EARLIER(Data[Member Code])&&Data[Date of Disbursement]<EARLIER(Data[Date of Disbursement])))
Hope this helps.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
93 | |
77 | |
65 | |
53 |
User | Count |
---|---|
147 | |
106 | |
104 | |
87 | |
61 |