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.
Dear Team,
I need help to return the following,
For every Project Number in the table ,I want to calculate the sum of ‘Cost’ that has the minimum ‘Date’ present for that project number and a ‘Status’= L .
Project Number Status Date Cost
1 L 12/4/2020 10
1 L 12/4/2020 10
1 L 12/18/2020 5
1 N 1/14/2020 8
I need to return, cost = 20 for Project Number 1 having a date 12/4/2020 &Status 'L'. Kindly suggest
Thanks for helping me solve my long time problem. The solution contained in this thread gave me a good clue to solve my own challenging DAX problem!
Thanks!
Hi @Anonymous
1. Place Project Number in a table visual
2. Place this measure in the visual
Measure =
CALCULATE (
VAR lastDate_ =
MIN ( Table1[Date] )
RETURN
CALCULATE ( SUM ( Table1[Cost] ), Table1[Date] = lastDate_ ),
Table1[Status] = "L"
)
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Hello AIB,
Thank you so much for your quick response. I did use the measure suggested and the table view returns no value. The project number is the unique key that drives Cost, Status and Date. Do we need to incorporate that in the query as well ?
Thanks in advance!
@Anonymous
It's working on my side. See it all at work in the attached file.
You can also select the "L" on a slicer rather than having it hardcoded in the measure
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
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.