Forum Discussion
How to hide the values in the Matrix based on the condition
- 1 year ago
Hi chyang0107
It’s not possible to filter measures directly based on a condition. Filters work at the level of a single column in a table or a single measure output, but you can’t filter out other measures placed in Values.
What you can do is create an “imitation of a measure table” and use a dynamic measure.
For example, if you have measures:
a, b, c, dYou can build a table like in the picture and then a dynamic measure:
dynamicMeasure =
var selected_ =SELECTEDVALUE('Table'[column])
RETURN
SWITCH(selected_,
"a",[a],
"b",[b],
"c",[c],
"d",[d],
BLANK())Then it can be filtered…
If the filtering condition is fixed (and not something the user is expected to control), you can also apply the logic directly inside the formula:
dynamicMeasure2 =
var selected_ =SELECTEDVALUE('Table'[column])
RETURN
SWITCH(TRUE(),
selected_="a"&& [a]<12,[a],
selected_="b"&& [b]<12,[b],
selected_="c"&& [c]<12,[c],
selected_="d"&& [d]<12,[d],
BLANK())In addition, you could consider Field Parameters, which work under a similar logic but are easier to configure in the UI, or Calculation Groups in Tabular Editor, which are more powerful but require extra setup.
The pbix with the example is attached
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
Hi chyang0107
It’s not possible to filter measures directly based on a condition. Filters work at the level of a single column in a table or a single measure output, but you can’t filter out other measures placed in Values.
What you can do is create an “imitation of a measure table” and use a dynamic measure.
For example, if you have measures:
a, b, c, d
You can build a table like in the picture and then a dynamic measure:
dynamicMeasure =
var selected_ =SELECTEDVALUE('Table'[column])
RETURN
SWITCH(selected_,
"a",[a],
"b",[b],
"c",[c],
"d",[d],
BLANK())
Then it can be filtered…
If the filtering condition is fixed (and not something the user is expected to control), you can also apply the logic directly inside the formula:
dynamicMeasure2 =
var selected_ =SELECTEDVALUE('Table'[column])
RETURN
SWITCH(TRUE(),
selected_="a"&& [a]<12,[a],
selected_="b"&& [b]<12,[b],
selected_="c"&& [c]<12,[c],
selected_="d"&& [d]<12,[d],
BLANK())
In addition, you could consider Field Parameters, which work under a similar logic but are easier to configure in the UI, or Calculation Groups in Tabular Editor, which are more powerful but require extra setup.
The pbix with the example is attached
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
Hello Rita,
I appreicate your detailed information and insights provided. Currently, I am using the Matrix (Not Table) to contain the information of interest (the information are placed under 'Value') and hopefully to hide these values based on the condition. Could I know if your suggestions measure or Field Parameters still work for my visualization?
Thanks,
Hank
- Ritaf19831 year ago
Super User
Hi chyang0107
My solution will work with all kind of visuals.
"Column " should go to columns
Dynamic measures to "values"If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly