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
gp93
Helper I
Helper I

Filtering a list with another list then collapsing columns back into SSAS

Hi all,

 

Not sure if possible. I want to filter a list of "account numbers" from an SSAS query using another list I have. Here is what i have so far:

 

let
    Source = AnalysisServices.Databases("bi-livecubes", [TypedMeasureColumns=true, Implementation="2.0"]),
    Cubes = Source{[Name="Cubes"]}[Data],
    LoanServicing1 = Cubes{[Id="LoanServicing"]}[Data],
    LoanServicing2 = LoanServicing1{[Id="LoanServicing"]}[Data],
    #"Added Items" = Cube.Transform(LoanServicing2,
        {
            {Cube.AddAndExpandDimensionColumn, "[Account]", {"[Account].[Account Number].[Account Number]"}, {"Account.Account Number"}}
        }),
    
    #"Filtered Rows" = Table.SelectRows(#"Added Items", each List.ContainsAny(Table2,{[Account.Account Number]})),
    #"Collapsed and Removed Columns" = Cube.CollapseAndRemoveColumns(#"Filtered Rows", {"Account.Account Number"})
in
    #"Collapsed and Removed Columns"

 

Get an error saying "The value is not a cube". Is there a way of doing this? if i was to filter to a single value using text.contains it would allow me to collapse columns?

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@gp93 

I am not familiar with CUBEs in PQ but 
Filter a column based on another list will go like:

= Table.SelectRows(Sales_Customers, each List.Contains(Query1, [CustomerCategoryID]))

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

2 REPLIES 2
Fowmy
Super User
Super User

@gp93 

I am not familiar with CUBEs in PQ but 
Filter a column based on another list will go like:

= Table.SelectRows(Sales_Customers, each List.Contains(Query1, [CustomerCategoryID]))

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Hi Fowmy,

 

Thanks for getting back to me, you have solved it! Very strange - List.ContainsAny was working to filter the list in the previous step but when i changed it to your method it now allows me to collapse the columns!

 

I will mark your post as the solution but would appreciate if anybody knows the reason for this to let me know just for my knowledge.

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.

Top Solution Authors