Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi All,
I have a pbix file which has a filter applied to it at PAGE LEVEL. I would like to swap the values shown within the TEXT BOX when ever user interacts with the filter for eg: when the user select 13 Period Rolling I would like to show below value inside the TEXT BOX (see first snip)
When the user select SECTION 2A I want the above TEXT BOX to display below shown value
and so on for other values available in the filter. I tried using BOOKMARK without any success, as I believe the above is just a TEXT BOX which has been hard coded with test values written inside it,
Do we have a way to achieve this functionality in Power BI, any help is highly appreciated. Many Thanks
Solved! Go to Solution.
Hi @HarishKM
DisplayText =
IF ( HASONEVALUE('Close Call Analysis P13 - 13 Period Rolling'[Area Type]),
SWITCH( TRUE (),
SELECTEDVALUE('Close Call Analysis P13 - 13 Period Rolling'[Area Type]) = "Section 2A", "Excluding: Site Welfare, Site Housekeeping: 88",
SELECTEDVALUE('Close Call Analysis P13 - 13 Period Rolling'[Area Type]) = "13 Period Rolling", "Excluding, Site Welfare, Site Housekeeping: 378",
etc),
BLANK())
If this is what you need, please mark as a solution.
Hope this helps
David
You'll need an empty string to close out SWITCH and another to close out IF
IF ( ... , SWITCH ( ... , ""), "")
Hi @smjzahid ,
Hi @HarishKM
That not the what I am after, as I mentioned earlier I have a column named (Area Type) as a text datatype and I am using this as a filter in my report, so what I would like to acheive is whenver the user selects a report from this filter (see below snip)
and when the user selects a different filter I want to change the values in the TEXT BOX field (see snip highlighted showing values as (Excluding Site Welfare, Site Housekeeping) for eg< If user selects SECTION 2A from the filter I want the TEXT BOX to show a different value.
I want to show below values (seen snip below in TEXT BOX)
Hi @HarishKM
DisplayText =
IF ( HASONEVALUE('Close Call Analysis P13 - 13 Period Rolling'[Area Type]),
SWITCH( TRUE (),
SELECTEDVALUE('Close Call Analysis P13 - 13 Period Rolling'[Area Type]) = "Section 2A", "Excluding: Site Welfare, Site Housekeeping: 88",
SELECTEDVALUE('Close Call Analysis P13 - 13 Period Rolling'[Area Type]) = "13 Period Rolling", "Excluding, Site Welfare, Site Housekeeping: 378",
etc),
BLANK())
If this is what you need, please mark as a solution.
Hope this helps
David
Hi @dedelman_clng,
Many Thanks for your updated DAX code on this, Yes this does works and this is what I want. However, when the user selectes any other option from the filter ( other than the one mentioned in below DAX code below
DisplayText =
IF ( HASONEVALUE('Close Call Analysis P13 - 13 Period Rolling'[Area Type]),
SWITCH( TRUE (),
SELECTEDVALUE('Close Call Analysis P13 - 13 Period Rolling'[Area Type]) = "Section 2A", "Excluding: Site Welfare, Site Housekeeping: 88",
SELECTEDVALUE('Close Call Analysis P13 - 13 Period Rolling'[Area Type]) = "13 Period Rolling", "Excluding: Site Welfare, Site Housekeeping: 378",
SELECTEDVALUE('Close Call Analysis P13 - 13 Period Rolling'[Area Type]) = "Section 2B", "Excluding: Site Welfare, Site Housekeeping: 112",
SELECTEDVALUE('Close Call Analysis P13 - 13 Period Rolling'[Area Type]) = "Section 2C", "Excluding: Site Welfare, Site Housekeeping: 126",
BLANK()))
I DO NOT want to show anything on the visual (not eveen BLANK) appearing inside the CARD visual
Replace BLANK() with empty string "" and that should give you what you want.
That's awesome, works perfect.
Appreciate your reply
Thanks @dedelman_clng
Yes already tried that option before posting reply to this thread. Still appear as BLANK,
when the user DO NOT select any filter
You'll need an empty string to close out SWITCH and another to close out IF
IF ( ... , SWITCH ( ... , ""), "")
Hi @smjzahid -
Usually in this situation you would create a measure that returns the text that you want, based on the filter selection, and then put that measure in a Card visual. The formatting options in a card aren't quite the same as in a text box, but you should be able to get mostly what you want.
The measure would be along the lines of
DisplayText = IF ( HASONEVALUE([Your Filter]),
SWITCH( TRUE (),
Filter Condition 1, "Text string 1",
Filter Condition 2, "Text string 2",
...)
Hope this helps
David
Thanks for your help, I tried to apply above measure but it throws below error. Please note in my report there is a TEXT column named Area Type which has the filter values that users will be picking from for example (see below)
DisplayText = IF ( HASONEVALUE([Your Filter]),
SWITCH( TRUE (),
[Your FIlter Column] = "FIlter Condition 1", "Text string 1",
[Your Filter Column] = "Filter Condition 2", "Text string 2",
...)
Also be sure to create it as a measure, not a calculated column.
Hi,
Its not letting me enter the name of my Filter Column as per your above revised code.
When I key in the name manually it undeline with a red colour, Its only allow measures in that location to be entered
and yes I am creating a measure (NOT calculated column)
[Your Filter Column] must include the table name, just like any other time the column is referenced in any piece of DAX code.
'Close Call Analysis P13 - 13 Period Rolling'[Area Type]
You can also try wrapping the full column name in SELECTEDVALUE()
SELECTEDVALUE('Close Call Analysis P13 - 13 Period Rolling'[Area Type]) = "XXX", "YYY"
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
100 | |
78 | |
64 | |
58 |
User | Count |
---|---|
148 | |
113 | |
97 | |
84 | |
67 |