Forum Discussion
Dynamic Text for a Drill Through
Hi SusanRay
After looking at your pbix, I'm unsure how/where you are using [Drillthrough Title Piece].
Regardless, would this help?
Drillthrough Title Piece =
VAR _ColorParm = SELECTEDVALUE( 'Color Parameter'[Color Parameter] )
RETURN
IF(
_ColorParm = "Overall",
"Overall",
IF(
_ColorParm = "Gender",
SELECTEDVALUE( 'Student Bio Demo'[Gender] ),
IF(
_ColorParm = "Race/Ethnicity",
SELECTEDVALUE( 'Student Bio Demo'[Ethnicity Race Group] ),
IF(
_ColorParm = "Minority",
SELECTEDVALUE( 'Student Bio Demo'[Minority] ),
SELECTEDVALUE( 'Student Bio Demo'[Residency level] )
)
)
)
)Hi gmsamborn ,
If you look at the Enrollment Count Detail Page, you will see a text box that includes the phrase (Color Parameter Selection). That is where I hoped to put the "Drillthrough Title Piece." (My bad. I wasn't consistent in my naming.)
Power BI did not throw an error when I created a measure using your proposed code. 🙂
But when I tried to 'add dynamic value' to the text box I am using for the title on the 'detail' page it wouldn't accept it. 😕
I then tried to add it as a table or a card, but it gave me a "Couldn't load the data for this visual" error. 😕
Specifically, it says,
As I said, I am very new to Power BI. This is supposed to be a Measure, right? Does it matter where that measure sits in my data?
- gmsamborn2 years ago
Super User
The following link refers to that error.
https://www.sqlbi.com/blog/marco/2022/06/11/using-selectedvalue-with-fields-parameters-in-power-bi/
Maybe try this...
Drillthrough Title Piece = VAR __SelectedValue = SELECTCOLUMNS ( SUMMARIZE ( 'Color Parameter', 'Color Parameter'[Color Parameter], 'Color Parameter'[p_Overall Fields] ), "_Color", 'Color Parameter'[Color Parameter] ) VAR _ColorParm = IF( COUNTROWS( __SelectedValue ), MAXX( __SelectedValue, [_Color] ) ) VAR _Logic = IF( _ColorParm = "Overall", "Overall", IF( _ColorParm = "Gender", SELECTEDVALUE( 'Student Bio Demo'[Gender] ), IF( _ColorParm = "Race/Ethnicity", SELECTEDVALUE( 'Student Bio Demo'[Ethnicity Race Group] ), IF( _ColorParm = "Minority", SELECTEDVALUE( 'Student Bio Demo'[Minority] ), SELECTEDVALUE( 'Student Bio Demo'[Residency level] ) ) ) ) ) RETURN _Logic // corrected - SusanRay2 years ago
Helper I
We are getting closer.
An updated file is available here: https://drive.google.com/file/d/1AkwWiwWJlF3HzduyjFATpsp33aka8r_q/view?usp=sharing
I was able to create the measure using your code without a problem, and by adding the [ ] I got the dynamic text added to the text box. But it isn't giving me the information I am looking for.
Rather than repeating the Color Parameter, which it does now, I want it to show which aspect of the selected measure was chosen for the drill through. (For example, 'Female' for Gender. OR 'Asian' for Race/Ethnicity. OR 'International' for Residency')
Does that make sense?
- SusanRay2 years ago
Helper I
Thank You!!!