Forum Discussion

sshiny's avatar
sshiny
Helper II
3 years ago
Solved

DAX- Date

 I am getting data for the last 7th day (Displays 29th Dec data as today is Jan 5th)using the below DAX

Last 7 days = TODAY()-7
 
I need a DAX to get the LAST 7 DAYS data. Please help amitchandak 
  • Hello sshiny,

     

    The measure that you wrote is a scalar value and will give you only one value.

    From what I have understood, you need to filter the calendar table using something like this:

     

    FILTER('Calendar', Calendar[Date] >= Today() - 7 && Calendar[Date] <= Today() )

    This will give a table of the Last 7 days or you can write a measure something like this

     
    Count = CALCULATE(COUNTROWS('Calendar'), FILTER('Calendar', Calendar[Date] >= Today() - 7 && Calendar[Date] <= Today() ))

     

     

    Hope this helps.

     

    Thank you,

    Vishesh Jain

2 Replies

  • visheshjain's avatar
    visheshjain
    Impactful Individual

    Hello sshiny,

     

    The measure that you wrote is a scalar value and will give you only one value.

    From what I have understood, you need to filter the calendar table using something like this:

     

    FILTER('Calendar', Calendar[Date] >= Today() - 7 && Calendar[Date] <= Today() )

    This will give a table of the Last 7 days or you can write a measure something like this

     
    Count = CALCULATE(COUNTROWS('Calendar'), FILTER('Calendar', Calendar[Date] >= Today() - 7 && Calendar[Date] <= Today() ))

     

     

    Hope this helps.

     

    Thank you,

    Vishesh Jain

  • sshiny 
    Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.