Berries
Berries

Reputation: 45

MAXX and CALCULATE

I am trying to have measure that can find the latest value of specific attribute. Not sure how to ask other than show the source data

Source Table

I have tried the following measures but I can't figure out how to extract Value for the Last Period over Owner and Attr. correctly. I have tried MAX, and MAXX but LastPer are not grouping over the Owner and Attr

LastPer = MAX(xxx[Period])

LastVal = CALCULATE(SUM(xxx[Value]), FILTER(xxx, xxx[Period] = xxx[LastPer]))

Giuven this table has > 33 million rows, and I need 10 specific items

last_a = CALCULATE([LastVal], xxx[Attr] = "a")
last_b = CALCULATE([LastVal], xxx[Attr] = "b")
last_c = CALCULATE([LastVal], xxx[Attr] = "c")

I am open to DAX Filtered table as opposed a measure for speed.

Desired outcome

Sometimes I wish I can use plain jane SQL in Power BI. Help please

Upvotes: 1

Views: 522

Answers (1)

David Browne - Microsoft
David Browne - Microsoft

Reputation: 89444

Try something like:

   lv = LASTNONBLANKVALUE('Table'[Period],max('Table'[Value]))

enter image description here

Upvotes: 1

Related Questions