DAX - Take string from another table WITHOUT a relationship

bauer24

New Member
Joined
Jan 12, 2009
Messages
23
Hi,

I have two tables. One is daily data (A) the other (B) has two date columns, a START and END date and a third column that contains some string.

E.g. - table B might look like so:

START,END,TEMP
01/01/2012,01/04/2012,"COLD"
02/04/2012,05/06/2012,"HOT"

etc.

If the temp column were numeric I could use sumx() and two filters to get the values across:

=sumx(filter(filter(B,DATEVALUE(Data[Date])>=B[Start]),DATEVALUE(Data[Date])<=B[End]),B[TEMP])

but i'm stuck as to how I get a string across. I haven't made a relationship as it didn't seem appropriate for this problem.

Any advice is much appreciated
 
Last edited:

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Use the following DAX expression as a calculated column: (here I assume 'StringLookup' is the table you specify above and 'Data' is the daily data table)

=CALCULATE(VALUES(StringLookup[temp] ), FILTER( StringLookup, Data[date] >= StringLookup[Start] && Data[date] < StringLookup[end] ) )


Javier Guillen
Senior BI Consultant
PowerPivot Blog: http://javierguillen.wordpress.com
Twitter: @javiguillen
 
Upvote 0

Forum statistics

Threads
1,215,463
Messages
6,124,963
Members
449,200
Latest member
indiansth

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