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
Anonymous
Not applicable

PathContains with SelectedValue in Calculated Column or Calculated Table

Hi, everyone.

 

I am stuggling with something. I am using the Path calculation to get a hierarchical path (e.g. A|B|C). When I reference this with a measure using PathContains and Selected Value, it works fine. Here is a measure I am using:

 

Rolled Up Total Est Prem :=
VAR c =
    SELECTEDVALUE ( Users[internalemailaddress] )
RETURN
    CALCULATE (
        SUM ( Opportunities[Total Est. Prem.] ),
        ALLSELECTED ( Opportunities ),
        PATHCONTAINS ( Opportunities[Manager Hierarchy], c )
    )

I also created a measure that shows the selected value:

User Selected Value := SELECTEDVALUE(Users[internalemailaddress])

But then when I create a calculated column to test a member of the path hierarchy (e.g. L1), the User Selected Value measure above only returns a blank. Here is the code:

 

Hierarchy SelectedValue = 
    if(Opportunities[L1]=[User Selected Value],TRUE(),FALSE())

Any idea how to get this working?

 

Thanks, Scott

 

 

1 ACCEPTED SOLUTION
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi Scott,

 

This is the trick of context. The context of SELECTEDVALUE in a calculated column is the whole table, So it would always return blank because there isn't a single selected value. Maybe you can try it with CALCULATE. But the calculated column won't interact with the slicer or filter in the report view.

Column = CALCULATE(SELECTEDVALUE(DimProduct[BrandName], "NOT Found"))

Best Regards,

Dale

 

Community Support Team _ Dale
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-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

Could you please mark the proper answer as a solution?

 

Best Regards,
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi Scott,

 

This is the trick of context. The context of SELECTEDVALUE in a calculated column is the whole table, So it would always return blank because there isn't a single selected value. Maybe you can try it with CALCULATE. But the calculated column won't interact with the slicer or filter in the report view.

Column = CALCULATE(SELECTEDVALUE(DimProduct[BrandName], "NOT Found"))

Best Regards,

Dale

 

Community Support Team _ Dale
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.