Forum Discussion
Use measure on filter dax function
Hello,
I'm trying to create a table visual that shows the bottom 3 of table X.
The value this top 3 is derrived from is a measure.
Due to this there are a bunch of 0,0 values that I need to get rid of, because now the bottom 3 are all value 0.0.
I tried using the FILTER function to filter out the 0,0 values, but when placing this measure into the visual it gives an error.
DAX filter used is:
4 Replies
- rubayatyasminCommunity Champion
Hey, Yvalson
Filter returns a table so if you place the measure in a visual that expects a single value, it will result in error.
refer: https://learn.microsoft.com/en-us/dax/filter-function-dax
try creating a calculated table with your given DAX, just add ALL,
Filtered Articles =
FILTER(
ALL(Articles),
[Gem. # dagen voorraad voorgaande week (verkoper)] > 0
)then create a measure using TOPN dax func.
refer: https://learn.microsoft.com/en-us/dax/topn-function-dax
- YvalsonFrequent Visitor
I see the problem of the measure used.
I tried the CALCULATETABLE function in my DAX measure, but this still gives an error.
The entire Dataset is connected via DirectQuery. Maybe this implicates the situation.
I am for example not able to use the New table or New column buttons in the ribbon.
The DAX function I created looked like this:
Articles Filtered =
CALCULATETABLE(
Articles; FILTER(
ALL(
Articles; [Gem. # dagen voorraad voorgaande week (verkoper)] > 0
)
)
)
- rubayatyasminCommunity Champion
Ah, DQ. Try this instead,
Idea measure:-
Third Lowest Measure =
VAR RankedValues =
ADDCOLUMNS (
ALL ( Articles ),
"RankedValue", [Gem. # dagen voorraad voorgaande week (verkoper)]
)
VAR NonZeroValues =
FILTER ( RankedValues, [RankedValue] > 0 )
VAR ThirdLowestValue =
TOPN (
3,
NonZeroValues,
[RankedValue],
ASC
)
RETURN
MINX ( ThirdLowestValue, [RankedValue] )this should give you an idea to solve the problem.
if this doesn't work, can you share the demo file?