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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
RENEALVAREZM
Frequent Visitor

Can't filter a calculated table to get children from selected

Hello everyone and apologies if this has been answered before. I cannot find any answer.

This is my scenario:


Plans table contains the following important columns for the scenario: [Plan] (the name of the plan), [PlanType] (the type of plan, which can be Portfolio, Program, Project, Epic, or Standalone Project), [Id] (the unique identifier of the plan), [Parent] (the identifier of the parent plan), [Plan Path] (a calculated column using the PATH function to show the access path of a plan in the parent/child relationship), [Plan Level] (the level of the plan in the path using the PATHLENGTH function), [Level 1] (a calculated column using the PATHITEM function corresponding to the top level of the plan hierarchy), [Level 2] (a calculated column using the PATHITEM function corresponding to the Portfolio level), [Level 3] (a calculated column using the PATHITEM function corresponding to the Program or Standalone Project level), [Level 4] (a calculated column using the PATHITEM function corresponding to the Project or Epic level).

What I need to do is to be able to select a value from that table, and then calculate the child plans when selecting a Portfolio or Program.

I have tried different calculated tables.

 

This one gives me an empty table:

Child Plans =
VAR _selectdplan = SELECTEDVALUE(Plans[Id])

RETURN
FILTER(
ALL(Plans),
PATHCONTAINS(Plans[Plan Path],_selectdplan)
)

 

This one gives me the parent instead of children:

ChildrenPlans =
VAR plan = SELECTEDVALUE(Plans[Id])
RETURN
CALCULATETABLE(
    Plans,
    Plans[Parent] = plan
)

 If I hardcode one value to test like this, it gives me the rows I need:
ChildrenPlans =

VAR plan = SELECTEDVALUE(Plans[Id])

RETURN

CALCULATETABLE( Plans, Plans[Parent] = "f8e991a3-74b9-4d43-b8c8-80dbaee72ea0" )

 

I'm obviously doing something wrong but can't figure out why.

Any help is appreciated.

2 ACCEPTED SOLUTIONS
HotChilli
Super User
Super User

"What I need to do is to be able to select a value from that table, and then calculate the child plans when selecting a Portfolio or Program." -  How are you selecting these values? If these values are from slicers or visuals, you're on the wrong track because you're creating tables with FILTER and CALCULATETABLE (These are created at refresh time and don't respond to slicers or visuals)

View solution in original post

Hi @RENEALVAREZM ,

 

Here I agree with HotChilli. According to your statement, I think you are creating a calculated table.

As far as I know, the calculated table or calculated column will not be dynamic based on slicer.

Here you use max function in your calculated table code, so it will always return the value with max id.

vrzhoumsft_0-1730106215839.png

I suggest you to try measure. Measure will return aggregation value which could be dynamic based on slicer.

For reference: Calculated Columns and Measures in DAX - SQLBI

 

Best Regards,
Rico Zhou

 

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

3 REPLIES 3
HotChilli
Super User
Super User

"What I need to do is to be able to select a value from that table, and then calculate the child plans when selecting a Portfolio or Program." -  How are you selecting these values? If these values are from slicers or visuals, you're on the wrong track because you're creating tables with FILTER and CALCULATETABLE (These are created at refresh time and don't respond to slicers or visuals)

Thanks for your prompt response. I'm applying drill-through. This should update the results of DAX expressions correct?
I'm testing with a direct filter in the page, and even if I have the correct Id for the parent, the ChildrenPlans table is not being correctly filtered and I have no idea why.

ChildrenPlans1.pngChildrenPlans2.png

Hi @RENEALVAREZM ,

 

Here I agree with HotChilli. According to your statement, I think you are creating a calculated table.

As far as I know, the calculated table or calculated column will not be dynamic based on slicer.

Here you use max function in your calculated table code, so it will always return the value with max id.

vrzhoumsft_0-1730106215839.png

I suggest you to try measure. Measure will return aggregation value which could be dynamic based on slicer.

For reference: Calculated Columns and Measures in DAX - SQLBI

 

Best Regards,
Rico Zhou

 

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

 

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.