Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi all,
I have set up a calculation group using tabular Editor. Users of the report can select one out of 4 measures to evaluate the page. Now I would like to extract the name of the calculation item they choose to use as a dynamic title.
So if user selects "Sales amount" from the calculation group slicer on the raport page I want the Month overview to say:
Month overview for Sales amount.
If the user selected [Margin]. It should say [Month overview for Margin].
I was able to do this using ="Month overview"& SELECTEDVALUE('table'[column]) on a normal tabel but I cannot seem to get it to work with a calculation group table. Do any of you have an Idea?
Solved! Go to Solution.
Hi @BobKoenen,
As the document said, these functions are based on the calculation groups. How did you calculate group settings? Did you confirm you have correctly configured these fields and properties?
If not, you can take a look at the following blog that mentioned about create calculate groups in power bi dekstop:
Creating Calculation Groups in Power BI Desktop
Regards,
Xiaoxin Sheng
@BobKoenen I had the exact same issue, creating a conditionally formatted title for a visual.
Inspired by a SQLBI video one way to solve this is to:
1) Create a disconnected table, referencing your Calculation Group (in this example 'Internal Calc Group').
Disconnected table =
-- This is the disconnected table available for the user (put 'Disconnected table'[Measure] field in the slicer).
SELECTCOLUMNS(
'Internal Calc Group',
"Measure",'Internal Calc Group'[Name],
"Ordinal",'Internal Calc Group'[Ordinal]
)
2) Use a Generic measure in your visual as Values.
This Generic measure will be replaced based on the slicer selection, therefore it behaves as if a Calculation Group were applied on it ('Disconnected table'[Measure] values are treated as Calculation Items of 'Internal Calc Group'), plus - since the field in the slicer is from a regular table - its value can be captured by SELECTEDVALUE.
Generic measure :=
-- To be replaced according to your Calculation Items.
CALCULATE(
COALESCE([MeasureInYourCalcItem1],[MeasureInYourCalcItem2],[MeasureInYourCalcItem3]),
TREATAS(
VALUES('Disconnected table'[Measure]),
'Internal Calc Group'[Name]
)
)
3) Create a measure for the dynamic title.
Dynamic title := "Month overview for " & SELECTEDVALUE('Disconnected table'[Measure])
So I've come up with a terrible work around.
The new smart text functions of a text box can return the value we're looking for. So visually you can replace your chart title with a text box using smart text.
Thanks, I had the same issues that the resut from the calculation would come up instead of the name. Its not a terrible work around for me, it did the trick 🙂
The pro is that it got me to learn a little more about Smart Text.
the con is that the font I use for the other chart titles (Segoi UI I think) isn't available in Smart text. And it's the Power BI default!
I have the same problem. SelectedValue, SelectedMeasure, SelectedMeasureName all result in two returns -- the actual result of the measure (numeric or percentage) or it returns the name of the measure "Selected KPI" that contains the SelectMeasure() as part of the calc group. But I can never get to the actual name of the caclulate item or even the name of the measure associated with the calculated item.
I defined a measure, calcitemselected, with selectedvalue( calcgroup[calcitem] ) returning the underlying selectedmeasure instead of the selected calc group item. Eventually realised my calcitemselected measure was set to decimal not text, once I changed to text it worked perfectly. Have also found selectedvalue( calcgroup[calcitem] ) = "x" to work fine in switch statements.
Hi @BobKoenen,
As the document said, these functions are based on the calculation groups. How did you calculate group settings? Did you confirm you have correctly configured these fields and properties?
If not, you can take a look at the following blog that mentioned about create calculate groups in power bi dekstop:
Creating Calculation Groups in Power BI Desktop
Regards,
Xiaoxin Sheng
How do you return a string with the name of an item in the calculation group? Purpose would be to use in a dynamic chart title.
I believe this is what you are looking for: SELECTEDMEASURENAME function (DAX) - DAX | Microsoft Docs
@lbendlin I thought so to but if I use
measure = SELECTEDMEASURENAME()
it gives me the value of the measure and not the name in a string
Agree with BobKoenen. When using Selected Measure Name, you get the name of the measure that is dragged into the values area of the chart. In my case, I've followed the example at the below link. When I use Selectedmeasurename all I get is "Selected Chart Item" which is the name of the measure item I created in Tabular Editor. What I want is the name of the Calculation item to return as a string so that I can use that string as the title of the chart. Thus, when I change my slicer to "Revenue" the chart title changes to say "Revenue".
https://exceleratorbi.com.au/dynamic-formatting-of-switch-measures/