cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Impactful Individual
Impactful Individual

Unable to use Memory table created by SUMMARIZE and ADD COLUMNS with MIN()

Hello Fellow Daxers,

I have created a table using SUMMARIZE and ADDCOLUMNS.  Now I’m stumped…when I try to compute the MIN() of a column in this Memory table,  I get the error:

Table variable 'SummarizeTrendsTable' cannot be used in current context because a base table is expected.

(Incidentally, I have confirmed that the SUMMARIZE and ADDCOLUMNS code works…by looking at the results if I create a “New Table” with the code.  Not what I'm doing, mind you, but just to be sure I know it works)

Is it true I can’t use the MIN() function a “Memory Table”?
Thank you in advance!  Tom

Here’s the ADDCOLUMNS and SUMMARIZE code with the . It's a small table--about 15 rows each time it's "called".

 

 

TestForForum = 
(some housekeeping: create LastValue, VariableName, ProviderNo)
VAR SummarizeTrendsTable = 
ADDCOLUMNS(
SUMMARIZE( FILTER(Tr_Select,AND(Tr_Select[Variable_Name] = VariableName, Tr_Select[ProvdrNo] = ProviderNo)), 
       		Tr_Select[Measure End Date],
              	Tr_Select[ProvdrNo],
              "MetricValue" , AVERAGE(Tr_Select[Variable_Value])),
              	"LastValue" , LastValue,
               "DataTrend" , DIVIDE((LastValue - [MetricValue])* 100 ,[MetricValue]))
        RETURN
        MIN(SummarizeTrendsTable[DataTrend])//<---here’s the MIN() function.

 

 

   

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Community Champion
Community Champion

@ThomasDay 

I am not sure in which context you want to use this table; yet,

MINX should work

 

 MINX ( SummarizeTrendsTable, [DataTrend] )

 

________________________

Did I answer your question? Mark this post as a solution, this will help others!.

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube, LinkedIn 

View solution in original post

Highlighted
Impactful Individual
Impactful Individual

I've fixed the second problem by using the filter function with same "pattern" as @Fowmy  used in first reply.

 

 

CALCULATE(MINX(SummarizeTrendsTab,[DataTrend]),FILTER(SummarizeTrendsTable,[MonthsDuration] > 0))

 

 

 

View solution in original post

3 REPLIES 3
Highlighted
Community Champion
Community Champion

@ThomasDay 

I am not sure in which context you want to use this table; yet,

MINX should work

 

 MINX ( SummarizeTrendsTable, [DataTrend] )

 

________________________

Did I answer your question? Mark this post as a solution, this will help others!.

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube, LinkedIn 

View solution in original post

Highlighted
Impactful Individual
Impactful Individual

@Fowmy 

But that leads to the next issue: When I use the MINX within a Calculate Statement to filter...per the below, I get the error 
"Cannot find table 'SummarizeTrendsTable'"

 

Does that make sense to you?

 

 

CALCULATE(MINX(SummarizeTrendsTab[DataTrend]),SummarizeTrendsTable[MonthsDuration] > 0)

 

Highlighted
Impactful Individual
Impactful Individual

I've fixed the second problem by using the filter function with same "pattern" as @Fowmy  used in first reply.

 

 

CALCULATE(MINX(SummarizeTrendsTab,[DataTrend]),FILTER(SummarizeTrendsTable,[MonthsDuration] > 0))

 

 

 

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Community Conference

Microsoft Power Platform Communities

Check out the Winners!

secondImage

Create an end-to-end data and analytics solution

Learn how Power BI works with the latest Azure data and analytics innovations at the digital event with Microsoft CEO Satya Nadella.

Top Solution Authors
Top Kudoed Authors