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
samdthompson
Memorable Member
Memorable Member

Dynamic Cube.AttributeMember

Hello, I am pulling data from analysis services. In the initial steps i am wanting to limit the data by use of the calendar year. The years are dynamic so they could be 2022-2022 or 2021-2023 etc. Currently my code does this:

 

= Table.SelectRows(#"Added Items", each (
Cube.AttributeMemberId([Calendar.Cal Year]) = "[Calendar].[Cal Year].&["&Start_yyy&"]" meta [DisplayName = "2022"] or
Cube.AttributeMemberId([Calendar.Cal Year]) = "[Calendar].[Cal Year].&["&End_yyy&"]" meta [DisplayName = "2022"]))

 

This will only work for 2 years however. I would like to make this part of the query a between but clearly as soon as I reformat the fields as numbers, I loose the ability to fold which is a no go for the rest of the things i need to do.

 

How do I create a between type or a within a list argument and still allow the query to fold?

 

Cheers

// if this is a solution please mark as such. Kudos always appreciated.
2 ACCEPTED SOLUTIONS

Agreed that the within list precludes query folding so is there a solution to mimic a between type filter or mimic a list type filter?

// if this is a solution please mark as such. Kudos always appreciated.

View solution in original post

If anyone come across this the answer is yes, folding can continue if you use this M Code: 

 

Table.SelectRows(#"Added Items", each

List.Contains(FYS, //where the years in this case are a list

[Shift Date.Fin Year] //name of the cubeattribute

) = true)

 

 

// if this is a solution please mark as such. Kudos always appreciated.

View solution in original post

3 REPLIES 3
v-yingjl
Community Support
Community Support

Hi @samdthompson ,

For query folding, as far as I know, relational data source transformations that can be query folded are those that can be written as a single SELECT statement. A SELECT statement can be constructed with appropriate WHERE, GROUP BY, and JOIN clauses. It can also contain column expressions (calculations) that use common built-in functions supported by SQL databases.

 

See: Transformations that can achieve folding 

 

In this thread, I doubt whether create a between type or a within a list argument still supports query folding.

 

In addition, here is the similar thread which is also used Cube.AttributeMemberId and wanted to achieve it dynamically but within another way that you can refer:

Power Query - Get Data from AnalysisServices (Cube) - Filter with User-Function result 

 

Best Regards,
Community Support Team _ Yingjie Li

Agreed that the within list precludes query folding so is there a solution to mimic a between type filter or mimic a list type filter?

// if this is a solution please mark as such. Kudos always appreciated.

If anyone come across this the answer is yes, folding can continue if you use this M Code: 

 

Table.SelectRows(#"Added Items", each

List.Contains(FYS, //where the years in this case are a list

[Shift Date.Fin Year] //name of the cubeattribute

) = true)

 

 

// if this is a solution please mark as such. Kudos always appreciated.

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.