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.
What formula / measure can be used to calculate the number of days between the last and the last but one sale? There is the following table and it is necessary to calculate, for example, the number of days between sales of company1 on 10/21/2020 (last) and 12/31/19 (penultimate).
Or you can just suggest how to find the penultimate sale of the company. Calculate the number of days between I can myself.
Solved! Go to Solution.
@SErgey-kuznetso , as new columns
max Date = maxx(filter(Table, [company] =earlier([company])),[Date])
second last = maxx(filter(Table, [company] =earlier([company]) && [Date] < earlier([max Date]) ),[Date])
diff = datediff([second last],[max Date],day)
or as measures
max Date = maxx(filter(allselected(Table), [company] =max([company])),[Date])
second last = maxx(filter(allselected(Table), [company] =max([company]) && [Date] < max([max Date]) ),[Date])
diff = datediff([second last],[max Date],day)
@SErgey-kuznetso , as new columns
max Date = maxx(filter(Table, [company] =earlier([company])),[Date])
second last = maxx(filter(Table, [company] =earlier([company]) && [Date] < earlier([max Date]) ),[Date])
diff = datediff([second last],[max Date],day)
or as measures
max Date = maxx(filter(allselected(Table), [company] =max([company])),[Date])
second last = maxx(filter(allselected(Table), [company] =max([company]) && [Date] < max([max Date]) ),[Date])
diff = datediff([second last],[max Date],day)
Try out this Measure. I am also attaching screen shot with output:
Not clear, use something like this.
DATEDIFF(DATE(2020,10,21),DATE(2019,12,31),DAY)
Regards,
Manikumar
Proud to be a Super User!
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 | |
99 | |
76 | |
64 | |
58 |
User | Count |
---|---|
148 | |
113 | |
97 | |
84 | |
67 |