# DAX measure show the latest weeks SalesAmount pr product

#### tiawy

##### New Member
Hi guys
I have a DAX question that I hope you guys can help me with:
My data looks like this:
ProductWeekSalesAmount
Product14820100
Product24715900
Product14910400
Product24814900

<tbody>
</tbody>
I would like an end-result that looks like this, that shows the latest week and latest weeks sales amount pr product.

So if i for instance have two different products, product1 and product2 my endresult would look like this:

ProductLatestWeekLatestSalesAmount
Product14910400
Product24814900

<tbody>
</tbody>
I have the measure for "Latest week":
LatestWeek:= MAX([Week])
However i need the measure for LatestSalesAmount. I was thinking something like this, but that is not allowed:

LatestSalesAmount:= CALCULATE(SUM([SalesAmount]);[Week]=MAX([Week]))
Thanks!

### Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
One way to do it is to add Calculated column.

"LatestWeek" =IF([Week]=Calculate(Max([Week]),FILTER(Table1,[Product]=EARLIER([Product]))),"Yes","No")

Then just use that column as Report Filter or Slicer and filter for "Yes".

Try this - create measure:

LatestSalesAmount:=CALCULATE(MAX([SalesAmount]);FILTER(Table1;[Week]=MAX([Week])))

and in PivotTable:

ROWS: Product
Σ VALUES: LatestWeek, LatestSalesAmount

Hi guys

Thank you very much.

I ended up using LatestSalesAmount:=CALCULATE(MAX([SalesAmount]);FILTER(Table1;[Week]=MAX([Week])))
and It works like a charm

Thanks again and merry christmas

Replies
1
Views
216
Replies
0
Views
232
Replies
1
Views
275
Replies
0
Views
285
Replies
1
Views
2K

1,196,268
Messages
6,014,339
Members
441,816
Latest member
Klingon1960

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back