Forum Discussion
DAX to pick up value
- 6 years ago
Well, interesting question! I've copied your dataset into PBI and got to work. This seems to work;
MaxSeqCurrentApproved = CALCULATE(SUM('Table'[Cost]), FILTER('Table', 'Table'[Seq] = CALCULATE(MAX('Table'[Seq]), FILTER('Table', 'Table'[CurrInd] = "Current" && 'Table'[Status] = "Approved"))))Explaination:We take the sum of Cost -> although it is just one row
with a Filter on the table, -> here is the tricky part
where Seq = the Max seq with a filter -> this will work where the context is sliced by Item btw,
where CurrInd = Curent AND Status = Approved -> having the Seq with Current and Status set correctly is enough, we don't need a second filter on these fields.
Ain't pretty but it works in my test (which is a matrix with rows=ItemID (not summarized) and values=Measure) 🙂
Please mark as solution if this answers your question.
Hi,
Drag Item ID to the Row labels and write these 2 measures
Last sequence number = CALCULATE(LASTNONBLANK(Data[Seq],1),Data[Status]="Approved",Data[Curr Ind]="Current")Costs = LOOKUPVALUE(Data[Cost],Data[Seq],[Last sequence number],Data[Status],"Approved",Data[Curr Ind],"Current")
I see no sense in showing Curr Ind and Status in the visual because they are the very conditions for our calculations.
Hope this helps.