Forum

Newest / Latest dat...
 
Notifications
Clear all

Newest / Latest data

4 Posts
2 Users
0 Reactions
63 Views
(@wittekindzement)
Posts: 8
Active Member
Topic starter
 

Hi,

to build My Dashboard I use imported invoice data from the last 4 years via Power Query from an Oracle databank. 

One of the things I need to Show is what the current price for a particular customer is, as the price can vary up and down.

I have a feeling that I need to be using a DAX Formula but I can't figure it out.

So basically what I need to do is return the amount from the price column which corresponds to the youngest date for a particular customer ID

Any Ideas? 

 
Posted : 28/11/2019 6:42 am
(@mynda)
Posts: 4761
Member Admin
 

Hi Andrew,

It's difficult to be specific without seeing your model structure, but let's say you build a PivotTable with Customer ID in the row labels. You can write a measure something like this:

=CALCULATE(SUM(Table1[Price]), FILTER(ALL(Table1[Date]),[Date]=MAX([Date])))

See attached.

Mynda

 
Posted : 28/11/2019 7:56 am
(@wittekindzement)
Posts: 8
Active Member
Topic starter
 

Hi Mynda,

I changed the Measure to calculate the Max and it worked great thankyou.Smile

Latest Price:=CALCULATE(MAX(LieferscheinData[Preis]);FILTER(ALL(LieferscheinData[Datum]);[Datum]=MAX([Datum])))

I use a German version of Excel so my Syntax sometimes looks different ie. we use ; instead of , but fortunately all of DAX is in English even in the German version, so I don't have to scratch my head translating formulas.

 
Posted : 28/11/2019 1:09 pm
(@mynda)
Posts: 4761
Member Admin
 

Glad I could help. If you're using MAX then this suggests that you have multiple prices for a single date and you're finding the maximum value for a date/period. If there's a possibility that the price goes down, then MAX will return the wrong result. Again, I don't know your data, but just thought I'd mention it in case.

 
Posted : 28/11/2019 6:38 pm
Share: