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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
CantonBI
Frequent Visitor

SELECTEDVALUE not accessible in "Data mode"?

Objective:

     Build a table whose content changes with the SELECTEDVALUE

 

Design:

  1. Selectable - a single column table with a list of selectable part_work_order
  2. Lineage - multiple columns table containing part_work_order, parent_work_order and the path (from the PATH function)

Problem:

     From the visual, I can see the correct path via SELECTEDVALUE(Lineage[path]).  However, when I try to build a table to list the content, the SELECTEDVALUE does not provided any value.

CantonBI_0-1663520087389.png

 

 

As troubleshooting, I replaced the SELECTEDVALUE() call with hardcoded string and it works.  What am I missing?  Thank you!

 

1 ACCEPTED SOLUTION

@CantonBI 
Click on the table visual that you want to filter and in the filter pane place this measure

Filter Measure =
COUNTROWS (
    FILTER (
        Lineage,
        CONTAINSSTRING ( SELECTEDVALUE ( Lineage[_path] ), Lineage[PART_WORK_ORDER] )
    )
)

1.png

View solution in original post

12 REPLIES 12
bcdobbs
Super User
Super User

Hi, is that a calculated table you're trying to build? If so they're calculated at refresh time and never dynamically interact with the filter context.

 

You'd need to use a table variable in a measure and then calculate on top of it.

 

What visual output are you after?



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

it is a calculatedtable, but I don't have to use it...I was trying different options...since I couldn't get it to work.  I guess...the key challenge is here how to select a list of part_work_order that exist in the PATH.  🙂

Hi @CantonBI 
You can wrap the same table formula with COUNTROWS and create it as measure. Place this measure in the filter pane of your visual and select "Is not blank" then apply the filter. This way it will work dynamically with your selection.

@tamerj1 ...can you clarify?  I am not sure I understand.  

@CantonBI 
Please copy/paste the formula of the calculated table so I can edit on top of it.

FILTER(Lineage, CONTAINSSTRING(SELECTEDVALUE(Lineage[_path]), Lineage[PART_WORK_ORDER]))

@CantonBI 
Click on the table visual that you want to filter and in the filter pane place this measure

Filter Measure =
COUNTROWS (
    FILTER (
        Lineage,
        CONTAINSSTRING ( SELECTEDVALUE ( Lineage[_path] ), Lineage[PART_WORK_ORDER] )
    )
)

1.png

thank you!  I got it to work...

* I embedded the Measure in a new calculated table which is just a copy of the Lineage table

* I modified the Filter a little

InSelectedPath = COUNTROWS ( FILTER ( 'SelectedLineage', CONTAINSSTRING ( SELECTEDVALUE ( Lineage[_path] ), [PART_WORK_ORDER] ) ) )

Keys here are:

* The Filter function uses the new table

* The SelectedValue function points to the Lineage table

 

 

 

 

For whoever who will be reading this in the future...BE CAREFUL when yo u draw the relationship.  After I got it working, I went to the modeling and link up the Lineage table and the SelectedLineage.  The result got altered!

It seems like the measure is producing "1" for all rows

@CantonBI 

It will produce 1 only if the condition is true otherwise the result is blank. 

I applied the measure in the Lineage table, but it seems like PBI is only evaluting the row picked out by the slicer.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.