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

Calculated table based on selected item

Happy Monday!

 

I have a page in a report where consumers can view surveys & survey responses (1:*). I'm using table visuals to display the surveys at the top of the page & survey responses at the bottom of the page. Currently, when they go to that page responses (table at the bottom) shows responses for all surveys; I'd like to clean this up a bit by possibly doing the following to the table at the bottom of the page:

  1. Display no responses until one survey is selected at the top of the page
  2. Display one response (thinking min/max here) at the bottom of the page until one is selected at the top of the page

These are for 'jobs.' We complete jobs and then send surveys to our customers. In the survey table there is one entry per job. In the survey response table, there are many entries per job (these are answers for each question on the survey).

 

My thought was I could create a third table which was a calculated table that only shows survey responses the job selected at the top of the page & if no job has been selected then do either item 1 or item 2 listed above. 

 

I took a few swings at this & in the end thought I could use a measure to capture the selected job (or 0) if no job had been selected:

 

job_filtered = 
VAR if_test =
    IF(
        ISFILTERED(survey_list[job_no]),
        SELECTEDVALUE(survey_list[job_no]),
        0
    )
VAR result = if_test
RETURN result

 

Based on the value this produced I figured I could then created a calculated table that would filter the survey responses. Here is me hacking away at this (I tried a variation of this using calculated table but NO DICE!).

 

testing_tbl = 
VAR selected_job_info =
    FILTER(
        survey_responses,
        survey_responses[job_no] = [job_filtered]
    )
VAR result = selected_job_info
RETURN result

 

As always, thanks for your time. A PRO LIFE TIP for reading this: listen to Anjunadeep mixes while parked in front of your PC/laptop. You're welcome 🙂

 

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

One of the basic tenets of Power BI is that filters cannot influence physical columns. This means a measure cannot create a calculated table.  It can filter a visual that shows existing content.

A measure can create a table variable which you then can contort into a scalar that looks like a table (CONCATENATEX with a carriage return divider, or HTML code that you then render in the HTML5 visual). Maybe that is an option for you.

View solution in original post

1 REPLY 1
lbendlin
Super User
Super User

One of the basic tenets of Power BI is that filters cannot influence physical columns. This means a measure cannot create a calculated table.  It can filter a visual that shows existing content.

A measure can create a table variable which you then can contort into a scalar that looks like a table (CONCATENATEX with a carriage return divider, or HTML code that you then render in the HTML5 visual). Maybe that is an option for you.

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.