March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello,
I want to use my slicer and when I select the value "Cars" then the output in my card has to be "Cars measure", when I select the value "Music" then the output in my card has to be "Music measure".
I'm getting a error using the following measure:
I do not know exactly what you need (single or multiple value ?), but you can try :
Filter = IF( SELECTEDVALUE('Sample Table'[Value3]) = "Cars", [Cars measure], [Music measure])
Works with single values, but shloud be your case, isn't it ?
Let us know
Hi @Tinus1905 ,
You don't use filter in this case. Filter returns a table and cannot be used in a measure without being aggregated.
The old school to achieve your end result as by creating a disconnected table containing the measure you want which can be created using the Enter Data feature or DAX then use a IF or SWITCH to return the measure you want. Example
Switching Measure =
SWITCH (
SELECTEDVALUE ( 'disconnected table'[measure name] ),
"Cars", [Cars Measure],
"Music", [Music Measure],
"Something", [Something Measure]
)
A faster and more efficient way to do is with the use of Field Parameters.
Proud to be a Super User!
Ah this works. But how do I use "NOT" in a value. For example: in the disconnected table [measure name] the list is longer with more names.
"Cars", [Cars Measure],
"Music", [Music Measure],
"<>Cars", [Something Measure]
"<>Music", [Something Measure]
The function <> isnt working.
@Tinus1905 Use field parameters.
Videos and blogs for reference:
Power BI Field Parameters — A Quick way for Dynamic Visuals: https://amitchandak.medium.com/power-bi-field-parameters-a-quick-way-for-dynamic-visuals-fc4095ae9af...
Power BI Field Parameters- Measure Slicer and Axis/Dimension slicer: https://youtu.be/lqF3Wa1FllE
Switch TOPN with Field Parameters: https://amitchandak.medium.com/switch-topn-with-field-parameters-299a0ae3725f
Field Parameters- Conditional Formatting
: https://amitchandak.medium.com/field-parameters-conditional-formatting-517aacc23fdf
Thanks, I'll go through it
Hi,
Be carefull with FILTER function which is an equivalent to CALCULATETABLE, so it means it returns a table which is not a valid argument for IF function.
You just need your test :
Filter = IF( 'Sample Table'[Value3] = "Cars", [Cars measure], [Music measure])
Hope it helps
With thisd I get a error:
A single value for column 'Value3' in table 'Sample Table' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
89 | |
84 | |
70 | |
51 |
User | Count |
---|---|
206 | |
143 | |
97 | |
79 | |
68 |