Forum Discussion
Measure that would show Multiple Values based on Slicer Selection
- 3 years ago
Hi EvanGetsItDone ,
You cannot use a measure and return two measures out of it. What can be done is you add both Magnitude and Period measures to a table but these measures should have a condition in it that returns blank depending on the slicer selection. The measure will only return blank and not hide its column. As a workaround, you can create a separate table (import/enter data/calc) that will hold the measure names and its groupings and you can create a measure using the measure name column from that table. Example calc table
MeasureTable = DATATABLE ( "Measure Group", STRING, "Measure Name", STRING, { { "Both Magnitude and Period Values", "Magnitude" }, { "Both Magnitude and Period Values", "Period" }, { "Magnitude Only", "Magnitude" }, { "Period Only", "Period" } } )the measure
FieldValue = SWITCH ( SELECTEDVALUE ( MeasureTable[Measure Name] ), "Magnitude", 40050, "Period", 13479122.76 )Please see attached sample pbix
Hi EvanGetsItDone ,
You cannot use a measure and return two measures out of it. What can be done is you add both Magnitude and Period measures to a table but these measures should have a condition in it that returns blank depending on the slicer selection. The measure will only return blank and not hide its column. As a workaround, you can create a separate table (import/enter data/calc) that will hold the measure names and its groupings and you can create a measure using the measure name column from that table. Example calc table
MeasureTable =
DATATABLE (
"Measure Group", STRING,
"Measure Name", STRING,
{
{ "Both Magnitude and Period Values", "Magnitude" },
{ "Both Magnitude and Period Values", "Period" },
{ "Magnitude Only", "Magnitude" },
{ "Period Only", "Period" }
}
)
the measure
FieldValue =
SWITCH (
SELECTEDVALUE ( MeasureTable[Measure Name] ),
"Magnitude", 40050,
"Period", 13479122.76
)
Please see attached sample pbix
- EvanGetsItDone3 years ago
Helper I
Hey,
Thanks for your response, this is a great logic and approach. However I don't think this works if the I use a measure or aggregate (in this case i SUM() the values) on the Switch (FieldValue measure). The grouping seems to only work if the else statement is String like what you did.- EvanGetsItDone3 years ago
Helper I
My Bad, I was not able to put the Measure Group on the Column field the reason it was just showing blank. I will accept this as solution as it helped me solved this issue. Thank you!