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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Power Query M Language Not Helping in Selecting Data

Hi, I am new to PowerBI.  I am trying to use a Direct Power Query to retrieve data from a very large SQL Server table to minimize the amount of data uploaded to my pc.


The table contains a column named Report-Week-Date which is the week ending Tuesday of the week the record was created.  For example a record created on Monday Dec 11 has a Report-Week-Date of 12-12-2017 for the week of 12-6-2017 - 12-12-2017.


I also only want to load the prior 52 weeks of data.  I have been using Crystal Reports for my reporting but want to shift everything to PowerBI.  With Crystal I create code to select records on the following criteria....... Report-Week-Date < Current Date and

Datediff("w",(Report-Week-Date), currentdate)  < 53.  Where I am subtracting the Report-Week-Date week number from the CurrentDate and selecting if it is less than 53.


I cannot get this to work in the Power Query M Language although I can find the matching commands in DAX.  Coding with DAX would defeat my intent because the entire table would be loaded to my pc.


Any help would be appreciated.

1 REPLY 1
McCow
Resolver III
Resolver III

Hi @Anonymous

 

A Query Editor has a lot of functions, from top interface level accesable to.

If your Report-Week-Date column has a date type you can manipulate of data load really simple, like this:

  

2017-12-17_00-27-51.pngCan it help you?

 

Best regs 

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors