Forum

DAX formula to show...
 
Notifications
Clear all

DAX formula to show latest value for field

3 Posts
2 Users
0 Reactions
88 Views
(@bpannell)
Posts: 22
Eminent Member
Topic starter
 

Mynda

i am familiar with using LASTDATE or LASTNONBLANK to give me the last date for which a table has non-blank values.

But how do you make use of this info to showcase say the corresponding value for a column in the same table, or a related derived measure not even in the table?  CALCULATE function doesn’t let me use measures in the filter expression.

ultimately, I want to be able to display such info in a multi card in PowerBI.

Thanks in advance.

Bob

 
Posted : 19/07/2019 2:29 pm
(@mynda)
Posts: 4761
Member Admin
 

Hi Bob,

It's not clear what you want to do or how your data is structured, but here is an example of using LASTNONBLANK with CALCULATE:

Latest Balance with formula :=
CALCULATE (
    SUM ( Data[Balance] ),
    LASTNONBLANK ( Calendar[Date], [Sum of Balance] )
)

This post explains more about those functions. If you want to exctract data from a related table then you may need to use the RELATED function. 

An example file containing some data and a mock up of the PivotTable you're wanting to build would be helpful in giving you a more detailed answer.

Mynda

 
Posted : 19/07/2019 8:19 pm
(@bpannell)
Posts: 22
Eminent Member
Topic starter
 

Thanks Mynda

I expressed my original question poorly.

I had created a measure based on table elements and was struggling to format things correctly, as it did not have a Table column.  In the end, after discovering a lot more about the importance of using Date Table dates instead of dates that don't support Time Intelligence functions, I ended up with:

 

Latest Balance with formula :=
CALCULATE (
    Measure ),
    LASTNONBLANK ( Calendar[Date], Measure )
)

 

In my case, Measure was a quirky average price metric.

Bob

PS I will ensure future questions are much clearer!

 
Posted : 20/07/2019 12:23 pm
Share: