cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
ccapowerbi
Resolver III
Resolver III

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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors