PowerPivot DAX Date Lookup

gavs73

Board Regular
Joined
Apr 22, 2008
Messages
138
Would appreciate any help with this, I have a PowerPivot table, and I want to add a Dax column to find the sale by customer the previous week, for each customer on date dd/mm/yy find the value for (dd/mm/yy-7days). Thanks in advance for your help. Gav
 

Attachments

  • dax.png
    dax.png
    18.4 KB · Views: 6

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Calculated Column: = LOOKUPVALUE(Table1[Value],Table1[Date],(Table1[Date])-7)
 
Upvote 0
Is there a way to reference the Company and Date in the same table, in Excel using SUMIFs it would be like this, not sure if it is possible in DAX... Thanks
 

Attachments

  • daxxx.jpg
    daxxx.jpg
    62.2 KB · Views: 6
Upvote 0
Not as a calculated column but as a measure:

PreviouWeekCustomer:=
VAR a = MAX ( 'Table1'[Date] )-7
VAR d =
CALCULATE (
MAX ( 'Table1'[Date] );
FILTER ( ALL ( 'Table1' ); 'Table1'[Date] < a );
VALUES ( 'Table1'[Customers] )
)
RETURN
CALCULATE (
SUM ( 'Table1'[Value] );
FILTER ( ALL ( 'Table1' ); 'Table1'[Date] = d );
VALUES ( 'Table1'[Customers] )
)
 
Upvote 0
Solution
Not as a calculated column but as a measure:

PreviouWeekCustomer:=
VAR a = MAX ( 'Table1'[Date] )-7
VAR d =
CALCULATE (
MAX ( 'Table1'[Date] );
FILTER ( ALL ( 'Table1' ); 'Table1'[Date] < a );
VALUES ( 'Table1'[Customers] )
)
RETURN
CALCULATE (
SUM ( 'Table1'[Value] );
FILTER ( ALL ( 'Table1' ); 'Table1'[Date] = d );
VALUES ( 'Table1'[Customers] )
)
thank you so much for your help
 
Upvote 0

Forum statistics

Threads
1,223,738
Messages
6,174,209
Members
452,551
Latest member
croud

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