The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I have a Power BI matrix that looks something like this:
Typically how this may look in power bi is the "type" column is a row value from the data and the "quantity" is a count distinct of the ID in the table.
Our current table is actually made with measures as the rows rather than a grouping by columns. "Type 1" is one measure, "Type 2" is another, and so on.
When I hover over a measure in the matrix I need to be able to display data about that measure in a tooltip. To do this I would want to pass the measure name as a variable similar to the behavior of SELECTEDVALUE([type]) in the first option. Example:
SWITCH( [SELECTED MEASURE NAME]
, "Type 1", Calcuate()
, "Type 2", Calculate()
...
)
Are there any Dax commands that could accomplish this?
Solved! Go to Solution.
@jburton Hmm, I don't think so as SELECTEDMEASURE only works with Calculation Groups. Perhaps if you can share some sample data and your measure formulas there might be an alternative. For example, switch the matrix back to columns instead of values on rows. Create a disconnected table with your types in a single column, we'll call this table Table and the column Column. Then you could create a single measure like this:
Measure =
VAR __Type = MAX('Table'[Column])
VAR __Result =
SWITCH( __Type,
"Type 1", [Type 1],
"Type 2", [Type 2],
"Type 3", [Type 3],
"Type 4", [Type 4],
"Type 5", [Type 5],
"Type 6", [Type 6],
"Type 7", [Type 7]
)
RETURN
__Result
Now replace all of your other measures in your matrix with this measure. Now you have a column that you can easily use in a SWITCH statement to identify what to do.
@jburton Hmm, I don't think so as SELECTEDMEASURE only works with Calculation Groups. Perhaps if you can share some sample data and your measure formulas there might be an alternative. For example, switch the matrix back to columns instead of values on rows. Create a disconnected table with your types in a single column, we'll call this table Table and the column Column. Then you could create a single measure like this:
Measure =
VAR __Type = MAX('Table'[Column])
VAR __Result =
SWITCH( __Type,
"Type 1", [Type 1],
"Type 2", [Type 2],
"Type 3", [Type 3],
"Type 4", [Type 4],
"Type 5", [Type 5],
"Type 6", [Type 6],
"Type 7", [Type 7]
)
RETURN
__Result
Now replace all of your other measures in your matrix with this measure. Now you have a column that you can easily use in a SWITCH statement to identify what to do.