sharepointsharepoint-designerdataviewwebpart

SharePoint DataView Show Items from last week


I have a SharePoint DataView WebPart that is set up to combine data from a few different lists. I want to filter the data to only show data from last week. I am able to filter it to show data from this week, but have been unsuccessful in getting last week's data to show up.

I have the web part filter set up like below:

Filter

This translates to the following xsl:

<xsl:variable 
    name="Rows" 
    select="/dsQueryResponse/Rows/Row[
        number(translate(substring-before(@Week_x0020_Starting,'T'),'-',''))
        &lt;=
        number(translate(substring-before($Today,'T'),'-',''))
        and
        number(translate(substring-before(@Week_x0020_Ending,'T'),'-','')) 
        &gt;=
        number(translate(substring-before($Today,'T'),'-','')]"/>

I speculate that I need to figure out how to do [Current Date] - 7, however I haven't been able to figure out how to do the subtraction. Has anyone encountered a situation similar to this? Am I even going about this correctly?


Solution

  • I managed to hack something together that does what I need:

    I created a calculated column on the list that shows the week start date + 7 days, and used that to compare to the current date.