DAX measure show the latest weeks SalesAmount pr product

tiawy

New Member
Joined
Nov 30, 2014
Messages
11
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

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
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".
 
Upvote 0
Try this - create measure:

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

and in PivotTable:

ROWS: Product
Σ VALUES: LatestWeek, LatestSalesAmount
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,213,511
Messages
6,114,054
Members
448,543
Latest member
MartinLarkin

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top