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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
NadaBen
Helper I
Helper I

dynamic filter

Hello,

 

I import this table below from BI (Analysis services), this table is huge and i cannot import it entirely, in addition i need restrictred information from it, i want to filter my "snapshot day" to be the recent day available, and the commonperiod.week to get only the 5 first weeks, knowing that when  i try to change the data type for commonperiod to date i have an error because the format "week 19, 2017" is not recognised by PowerBI.2.PNG

 

 

 

Thanks,

 

11 REPLIES 11
Anonymous
Not applicable

Hi @NadaBen,

 

You can try to add dynamic date filter in power query:

PowerQuery Dynamic Date Dimension Table Filtering

 

Regards,

Xiaoxin Sheng

Hi @Anonymous,

 

I read the article and followed the steps, but i don't seem to get the result. Actually, once i create (lastdate) and came back to the dable where i have the column table to do filter on it (date filter equals ), i got a error before changing "lastdate" in the M language.

 

What do you think is the problem?

Anonymous
Not applicable

Hi @NadaBen,

 

Can you please share sample file to test?

 

Regards,

Xiaoxin Sheng

Here is a sample of my table, so what i need is to keep the last "Snapshot day", then  12 first weeks of "Common period Week"

 

https://drive.google.com/open?id=0BwbSVJQB7uVJMmxZQTJIWjQ4aUk

 

Thanks

Phil_Seamark
Microsoft Employee
Microsoft Employee

Does your cube have a column that's DateTime/Date, or one that can be easily parsed to be DateTime/Date ?

 

Are you able to add columns to tabes in your cube?


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Unfortunately no !

Are you importing or doing a live connect?


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

I'm importing tables

You can write MDX against both MD and Tabular cubes.  With MDX it's possible to create dynamic date ranges using a combination of VBA and strtomember functions but this is medium to advanced MDX and definitely requires knowledge of your model.

 

 


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

hi @Phil_Seamark

 

That's the part of MDX query which i want to change to be dynamic

 

ON COLUMNS  FROM (SELECT ({[Snapshot].[Year - Week - Date].[Day].&[2017-06-05T00:00:00]},{[Common Period].[Year - Week - Date].[Year].&[2017-01-01T00:00:00]})

 

I want to always get the last day of  [Snapshot].[Year - Week - Date].[Day]

and the 12 first weeks of [Common Period].[Year - Week - Date].[Week]

 

Can you help me please ???

Anonymous
Not applicable

Hi @NadaBen,

 

You can try to use below formula to get the lastdata and week of month, then use these variable to filter.

 

Parameters:

    #"Added Custom" = Table.AddColumn(#"Changed Type", "Week of Month", each Date.WeekOfMonth([Snapshot.Day]))

    LastDate = List.Max(#"Added Custom"[Snapshot.Day])

    Today=Date.From(DateTime.LocalNow())

 

Filter formula:

 

Custom=  Table.SelectRows(#"Added Custom", each [Snapshot.Day] >= LastDate and [Week of Month] =1)

 

 

Reference link:

Date.WeekOfMonth

 

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors