# How to extract a specific row's value in DAX?



## cr731 (Feb 6, 2016)

I have a table in my data model that looks something like this,


ItemContentsCurrent MonthJan 2016Prior MonthDec 2015

And then I have another table with a listing of transactions by date (just by month, not specific to the day).

I want to create a calculated measure summing all transactions in the "Current Month" as it exists in my table shown above.  So I am trying to somehow extract the "Current Month" line from that table, and use it in a calculated measure, but having no luck.  I tried this,

=CALCULATE( DATEVALUE([Contents], FILTER( TableContents, TableContents[Item] = "Current Month") )

But this doesn't seem to work.

Any advice on how to resolve this or a better approach?

Thanks


----------



## Matt Allington (Feb 6, 2016)

firstly I am not sure that this is the best way to have your data, but then again I don't know what you are trying to do. 

I think the issue is that DATEVALUE expects a value, but you are passing a column. Try this

=CALCULATE( DATEVALUE(values([Contents]), FILTER( TableContents, TableContents[Item] = "Current Month") )

You may need to wrap part of the formula in an HASONEVALUE test, I'm not sure.  If so, you could try this, but I don't know if it will work. 

=CALCULATE( if(HASONEVALUE(tablecontents[item]), DATEVALUE(values([Contents])), FILTER( TableContents, TableContents[Item] = "Current Month") )


----------

