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
Anonymous
Not applicable

sum if date <

hi, I have a table like this.

mhv22_0-1649701837977.png

I need a measure to sum STOCK if date is<2022-03-10 (year= 2022, month= 03, day=10) I tried like this:

 

cantidad stock viejo = CALCULATE(SUM(curva_integrada[cantidad_stock]);curva_integrada[fecha_ultimo_ingreso] < 2022-03-10)
cantidad stock viejo = CALCULATE(SUM(curva_integrada[cantidad_stock]);curva_integrada[fecha_ultimo_ingreso] < 10-03-2022)
 
and all possible combinations, but it´s not working...what am I doing wrong??
 
thanks in advance!

 

 

 

 

 

1 ACCEPTED SOLUTION
vojtechsima
Memorable Member
Memorable Member

Hi, @Anonymous 
function DATEVALUE should do the trick.

CALCULATE(SUM(curva_integrada[cantidad_stock]);curva_integrada[fecha_ultimo_ingreso] < DATEVALUE("10/03/2021"))

View solution in original post

3 REPLIES 3
vojtechsima
Memorable Member
Memorable Member

Hi, @Anonymous 
function DATEVALUE should do the trick.

CALCULATE(SUM(curva_integrada[cantidad_stock]);curva_integrada[fecha_ultimo_ingreso] < DATEVALUE("10/03/2021"))
Anonymous
Not applicable

thanks @vojtechsima , that was very helpful!!!!

@Anonymous 
Happy to help, also there's another option and that is to use function DATE, where you would construct the date like this: 

DATE(<year>, <month>, <day>)  

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.