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
iiomarioii
Helper II
Helper II

PowerQuery: Filter: Keep all data till two months ago

Hi guys,

 

I would like to filter my query in PowerQuery with my Date column. I would like to keep all data till 2 months ago (so from todays view it would be till 24/09/2020)

 

What's the equivalent in DAX?

 

Any ideas? 

 

Thank you very much! 🙂

 

iiomarioii

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @iiomarioii ,

You can't write DAX in power query, you can only go to some DAX in desktop

According to your description, I created some data to show:

v-yangliu-msft_0-1606353233314.png

Here are the steps you can follow:

1. Create measure.

Measure =
CALCULATE(SUM('Table (2)'[amount]),FILTER('Table (2)','Table (2)'[Date]<=DATE(YEAR(TODAY()),MONTH(TODAY())-2,DAY(TODAY()))))

2. Result.

v-yangliu-msft_1-1606353233330.png

You can downloaded PBIX file from here.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yangliu-msft
Community Support
Community Support

Hi  @iiomarioii ,

You can't write DAX in power query, you can only go to some DAX in desktop

According to your description, I created some data to show:

v-yangliu-msft_0-1606353233314.png

Here are the steps you can follow:

1. Create measure.

Measure =
CALCULATE(SUM('Table (2)'[amount]),FILTER('Table (2)','Table (2)'[Date]<=DATE(YEAR(TODAY()),MONTH(TODAY())-2,DAY(TODAY()))))

2. Result.

v-yangliu-msft_1-1606353233330.png

You can downloaded PBIX file from here.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

ryan_mayu
Super User
Super User

@iiomarioii 

maybe you can create a new table

Table 2= FILTER(Table, [date]>=edate(today(),-2))

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.