Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
I have a small problem that I cant solve in efficient way. I want to create a new column "lastDatesales" which has "sum of sales "corresponding to the last purchase dates sales a company has. For example, company "a":s last purchase date was 10.1.2019, so I want to get the corresponding sales from that date to each row the company has.
My current solution is:
date | sales | company | lastDatesales (correct answer) |
1.1.2019 | 100 | a | 200 |
10.1.2019 | 200 | a | 200 |
1.1.2018 | 300 | b | 600 |
15.1.2018 | 600 | b | 600 |
Solved! Go to Solution.
Hi @user555
Modify az38's solution as below, then it can use to create a column
lastDatesales =
var _lastDate = calculate(MAX(Sheet1[date]),ALLEXCEPT(Sheet1,Sheet1[company]))
return
LOOKUPVALUE(Sheet1[sales],Sheet1[company],Sheet1[company],Sheet1[date],_lastDate)
Measure may perform quicker than column.
Check the performance under View->Performance Analyzer.
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @user555
Modify az38's solution as below, then it can use to create a column
lastDatesales =
var _lastDate = calculate(MAX(Sheet1[date]),ALLEXCEPT(Sheet1,Sheet1[company]))
return
LOOKUPVALUE(Sheet1[sales],Sheet1[company],Sheet1[company],Sheet1[date],_lastDate)
Measure may perform quicker than column.
Check the performance under View->Performance Analyzer.
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks a lot az38 and Maggie! Both answers were really helpful.
hi @user555
try a measure
lastDatesales =
var _lastDate = calculate(MAX(Sheet1[date]);ALLEXCEPT(Sheet1;Sheet1[company]))
return
LOOKUPVALUE(Sheet1[sales];Sheet1[company];SELECTEDVALUE(Sheet1[company]);Sheet1[date];_lastDate)
do not hesitate to give a kudo to useful posts and mark solutions as solution
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
143 | |
75 | |
62 | |
51 | |
47 |
User | Count |
---|---|
212 | |
82 | |
61 | |
60 | |
57 |