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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

Title Switcher with Calculation Groups

Hi, so i have a visual where I show numeric values and I can switch between KPIs with a Calculation Group. 

Next, I have a CG that calculates the numeric values into percentage of the whole. I have a chiclet Slicer to switch the % view  on or off. 
The Title switcher should work like this: if I select the % Value Button, I want the title to be "Käufer-Anteil" and when the % Value button is not selected, there should only be "Käufer".

When I turn the Slicer on to show % values, my title switcher gives out a 1 (I believe numeric value) and when I turn it off it says true. 

I would need the Titleswitcher Measure to change the 1 out to a true and the true to be a false. ,

 

Michella_0-1651137118868.png

This is the Measure

Titleswitcher =
VAR _Selection = SELECTEDVALUE('% Anteile'[Name] ) = "% - Werte"
VAR _LogicTest = IF(_Selection = "TRUE", "-Anteil", "")
VAR _SelectedKPI = SELECTEDVALUE('KPI'[Name])
RETURN
_SelectedKPI &" "& IF(_Selection, "- Anteil", "")


Theres then an error code:

Michella_1-1651137264574.png

 

3 REPLIES 3
v-henryk-mstf
Community Support
Community Support

Hi @Anonymous ,

 

The reason for the error is that "True" is a Text type, and the type returned by _Selection is a Boolean type, which cannot be compared directly.

 

vhenrykmstf_0-1651562116516.png

The formula needs to be converted as follows:

MeasureTitleswitcher = 
VAR _Selection =
    SELECTEDVALUE ( '% Anteile'[Name] ) = "% - Werte"
RETURN
    IF ( _Selection, "-Anteil", " " )

vhenrykmstf_1-1651562346083.png

MeasureTitleswitcher =
VAR _Selection =
    SELECTEDVALUE ( '% Anteile'[Name] ) = "% - Werte"
VAR _LogicTest =
    IF ( _Selection, "-Anteil", " " )
VAR _SelectedKPI =
    SELECTEDVALUE ( 'KPI'[Name] )
RETURN
    _SelectedKPI & " "
        & IF ( _Selection, "- Anteil", " " )

 

If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi Henry,

 

thanks for the help, for me it doesnt solve the problem. But my button to switch from percentage to absolute number is from a calculation group with only one measure and you have a slicer with two.
What should the measure be for absolute? I made it to be SELECTEDMEASURE() but this doesnt bring me the old error. My titleswitcher is formatted as text if this is from relevance.

 

Thanks again, Michaela

Anonymous
Not applicable

If I try only this part of the code
VAR _Selection = SELECTEDVALUE('% Anteile'[Name] ) = "% - Werte"

 

and use the % Value Button, it'll show 1, if the button is selected and "TRUE" if the button is not selected.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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