Table variable not being able to be used in CALCULATE in Measure

Hello Power BI Experts

I would have thought this DAX would be easy to solve, but I’m stumped!!

I’m creating a table (1-100)
Adding a calc column
Filtering the table, then
finding the min value

Min Spares =

var __pnso = 0.95
var __ExpectedFailures = 0.3280

var __sparesValue = GENERATESERIES(1, 100, 1)

var __caltable =
“Min Spares”, [Value],
“Calc”, [Value] * __ExpectedFailures)

var __filteredSpares =
FILTER(__calctable, [Calc] >= __pnso)

var __calculation =
MIN(__filteredSpares[Min Spares])

return __calculation

*** You should be able to cut and paste this code, to return the __calucation value.

I get an error, "Table variable '__filteredSpares cannot be used in current context becase a base table is expected.

Please could you HELP!!!

1 Like

@Tracey Use MINX/MAXX/SUMX. SUM, MIN, MAX etc don’t work with variables.

1 Like

Hello @Tracey,

Did the responses above from @AntrikshSharma help solve your query?

If not, can you let us know where you’re stuck and what additional assistance you need?

If it did, please mark the answer as the SOLUTION by clicking the three dots beside Reply and then tick the check box beside SOLUTION

Thank you

Hello @Tracey

We’ve noticed that no response was received from you on the post above.

Just following up if the response above help you solve your inquiry.
If it did, please mark his answer as the SOLUTION.

In case there won’t be any activity on it in the next few days, we’ll be tagging this post as Solved.

Hi @Tracey

Due to inactivity, a response on this post has been tagged as “Solution”.

If you have a follow question or concern related to this topic, please remove the Solution tag first by clicking the three dots beside Reply and then untick the check box.

We request you to kindly take time to answer the Enterprise DNA Forum User Experience Survey,.

We hope you’ll give your insights on how we can further improve the Support forum. Thanks!
emphasized text