Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ThomasDay
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
Fowmy
Super User
Super User

@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 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

ThomasDay
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
Fowmy
Super User
Super User

@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 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

ThomasDay
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)

 

ThomasDay
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))

 

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.