Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
AtikurRahman
Frequent Visitor

DAX query for given dates?

Hello,

 

At the moment we are using the following query to convey data to us based on YESTERDAY'S data:

 

= Webtrends.Tables("100886", Date.AddDays(Date.From(Date.From(DateTime.FixedLocalNow())), -1), Date.AddDays(Date.From(Date.From(DateTime.FixedLocalNow())), -1))

 

Now, if we change the -1 to -4, we will get data from 4 days before hand.

 

eg. Today = 16/08/2016

-4 = 12/08/2016

-5 = 11/08/2016

-3 = 13/08/2016

 

Unfortunately this only shows us data for that ONE date, what I want to do is to view data for a full 7 days prior to todays data. Is this possible, and if so how can we approach this?

 

 

Any advice would be appreciated.

 

Regards,

Atikur

2 REPLIES 2
v-shex-msft
Community Support
Community Support

Hi AtikurRahman,

 

According to your description, you want to view the data between today and seven days ago, right?

If as I said, you could use Filtered Rows to achieve your requirement, below is the query:

 

  #"Filtered Rows" = Table.SelectRows(#"Changed Type", each [Date] >= Date.From(Date.AddDays(DateTime.FixedLocalNow(),-7)) and [Date] <= Date.From(DateTime.FixedLocalNow()))

 

 Capture.PNG

Before filter:

 Capture2.PNG

After filter:

 Capture3.PNG

 

If above is not help, please provide more detail info and feel free to let me know.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

@v-shex-msft Apologies for the delayed response.

 

Our team has carried out the work and managed to get it working to an extent, thanks for all the help Xiaoxin!

 

Regards,

Atikur

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.