Calculate with filters problem

BKNewton29

New Member
Joined
Sep 17, 2010
Messages
30
All,

I'm currently trying to create three measures that will sum up a year to date figure for some data for three different years. The filter criteria is linked to a different table that updates from a connected table in Excel. The formula for the current year works fine (see below)

ActualValueYTD:=CALCULATE(SUM(SAGE[ActualValue]),FILTER(SAGE,SAGE[Year]=RELATED(Periods[Year])),filter(SAGE,SAGE[Month]<=RELATED(Periods[Month])))

However as soon as I change this to look at the prior year it returns a zero. I assume this is because I've filtered down to 2016 in the formula above so it can't see 2015 in the next formula (see below)


PYValueYTD:=CALCULATE(SUM(SAGE[ActualValue]),FILTER(SAGE,SAGE[Year]=RELATED(Periods[Prior])),filter(SAGE,SAGE[Month]<=RELATED(Periods[Month])))


As I'm new to DAX any help would be appreciated

thanks
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Is the 'Periods' table a true calendar table with a 'date' column (like 03/18/2016)? how is it related to 'SAGE' in data model? I ask because what you want to do should be simple enough, but need to know more information. Time Intelligence functions like TOTALYTD may make the most sense, but again depends on how the model is setup. You also may need to do something like this for prior year:

PYValueYTD:=CALCULATE(SUM(SAGE[ActualValue]),FILTER(SAGE,SAGE[Year]=RELATED(Periods[Year]) - 1 ),filter(SAGE,SAGE[Month]<=RELATED(Periods[Month])))
 
Upvote 0
It was a linked table to a pivot table in Excel.

I've managed to find a solution this evening by creating a variable that links to that table and is then used in the table.
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,818
Members
449,049
Latest member
cybersurfer5000

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