Forum Discussion
MRUGLADIATOR
2 years agoNew Member
DAX HELP - Return Corresponding value for minimum date
Hi there!
I am somewhat new to DAX and I am running into an issue:
I am using the "Opportunities Table" from the Regional Sales Sample pbix file and I am trying to do the following:
In the above table that I have created, for each Purchasing Process and Sales Stage, I wanted to know the earliest created date.
The DAX that I created for the "Earliest Created Date" was as follows:
Earliest Created Date = min(Opportunities[Opportunity Created On])
So what this returned me, was the earliest date that an Opportunity was created for each Sales Stage and Purchasing Process.
Now, I would like to have the corresponding "VALUE" for that "Earliest Created Date" & Sales Stage & Committee. In the above table, it is returning $10,131,326. However the correct value should have been $4,448.
Can anyone help me write the DAX to return the correct value?
Here the Sample pbix I am using from Microsoft: https://github.com/microsoft/powerbi-desktop-samples/blob/main/powerbi-service-samples/Regional%20Sales%20Sample.pbix
Hi MRUGLADIATOR,
Please try this DAX formula:SUM Value EarliestDate = VAR _EarliestDate = [Earliest Created Date] VAR _Table = FILTER( Opportunities, [Opportunity Created On] = _EarliestDate ) VAR _Result = SUMX( _Table, Opportunities[Value] ) RETURN _ResultThe final output should be this:
I'm attaching the pbix file with my solution.
1 Reply
- _AAndradeResident Rockstar
Hi MRUGLADIATOR,
Please try this DAX formula:SUM Value EarliestDate = VAR _EarliestDate = [Earliest Created Date] VAR _Table = FILTER( Opportunities, [Opportunity Created On] = _EarliestDate ) VAR _Result = SUMX( _Table, Opportunities[Value] ) RETURN _ResultThe final output should be this:
I'm attaching the pbix file with my solution.