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
slav84
Helper I
Helper I

Create new Table with latest records

Hello, 
I have a table from which I need to create new table that will agreggate the data based on Seller and only for the latests date for which i have data for.
First i created measure that will store the last date of my data.
MaxDate = Max('SellerPrices'[Date]')
Which indeed returns the latest date i have in my dataset

Now, when creating the table, I am using ADDCOLUMNS(SUMMERIZE....
And then creating column Amazon which will be the sum of all prices for amazon for the latest data for which i have the data. 

TestTable =
ADDCOLUMNS(
SUMMARIZE('SellerPrices','SellerPrices'[Date],'SellerPrices'[Brand],'SellerPrices'[Product]),
"Amazon",CALCULATE(SUM('SellerPrices'[Price]),'SellerPrices'[Seller] = "Amazon", 'SellerPrices'[Date] = [MaxDate]))

But when i do this I am getting an error:
"A function 'PlACEHOLDER' has been used in s True/False expression that is used as table expression filter. This is not allowed. "

Any idea what am i doing wrong here?
1 ACCEPTED SOLUTION
mangaus1111
Solution Sage
Solution Sage

Hi @slav84 ,

 

try to write [MaxDate] not like a measure, but like variable.

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
slav84
Helper I
Helper I

Thank you. 
That worked. 
But why did this work and not with measure?

Because indeed a variable is a constant, is a number and it is accepted in the 2nd argument of the Calculate function.

mangaus1111
Solution Sage
Solution Sage

Hi @slav84 ,

 

try to write [MaxDate] not like a measure, but like variable.

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.