Hello everyone!
I’m new to PowerBi and I’m trying to create two buttons to control the exibition of one visual.
I’ve tryed creating the following measure, but when I use it in value field of visual, no data is showed.
DinamicMeasure = SWITCH(TRUE(),
SELECTEDVALUE('Dinâmica'[Botão])="Qtd", [Total Autoconstrução] && [Total Vistoria Autoconstrução],
SELECTEDVALUE('Dinâmica'[Botão])="%", [% Autoconstrução no Prazo] && [% Vistoria Autoconstrução no Prazo],
[Total Autoconstrução] && [Total Vistoria Autoconstrução]
)
Is there any way to return two measures on the result of Switch?
The image below shows what I want to achieve using the DinamicMeasure in value field.
Thanks!
Solved! Go to Solution.
Combining two number measures with && likely just results in a boolean True. You should be able to do that with two separate measures with a similar structure, and put them both in the values area of your visual. Also note that SWITCH(TRUE() is not needed in this case (but it is good that you know how to use it for other scenarios).
DinamicMeasure1 = SWITCH(SELECTEDVALUE('Dinâmica'[Botão]),
"Qtd", [Total Autoconstrução],
"%", [% Autoconstrução no Prazo],
[Total Autoconstrução]
)
DinamicMeasure2 = SWITCH(SELECTEDVALUE('Dinâmica'[Botão]),
"Qtd", [Total Vistoria Autoconstrução],
"%",[% Vistoria Autoconstrução no Prazo] ,
[Total Vistoria Autoconstrução]
)
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Combining two number measures with && likely just results in a boolean True. You should be able to do that with two separate measures with a similar structure, and put them both in the values area of your visual. Also note that SWITCH(TRUE() is not needed in this case (but it is good that you know how to use it for other scenarios).
DinamicMeasure1 = SWITCH(SELECTEDVALUE('Dinâmica'[Botão]),
"Qtd", [Total Autoconstrução],
"%", [% Autoconstrução no Prazo],
[Total Autoconstrução]
)
DinamicMeasure2 = SWITCH(SELECTEDVALUE('Dinâmica'[Botão]),
"Qtd", [Total Vistoria Autoconstrução],
"%",[% Vistoria Autoconstrução no Prazo] ,
[Total Vistoria Autoconstrução]
)
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Hello @mahoneypat I had the same problem. your approach helped me to return two measures.
I am using line chart and my slicer options look like this:
Measure A / Measure B
Measure C / Measure D
Measure E / Measure F
I want to show a legend, but I can't control the names displayed dynamically.
I named the two switch measures "Measure 1" , "Measure 2" to indicate that the "Measure 1" is the one on the left side (e.g. Measure A) and "Measure 2" the one on the right (e.g. Measure B), but I would like to display the actual measure names.
Is there a way to controll the names in the legend dynamically?
Many thanks in advance.
Pat, thank you so much!
This was exactly what I want to do.
Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!