Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
 
					
				
		
Hello
I was trying to summarize a field, grouping it by the day before according to the most current date (D-1), the problem is that I noticed the dataset not always has the data from a previous day (sometimes is D-2 or D-5, etc.), So I need a Measure capable to detect the data from the max date previous the current date, here is my try, it just Summarize D-1, could you help me, guys?
D-1 = VAR DateFilter =
SELECTCOLUMNS ( VALUES ( Agencies_Inventory[date]), "Date-1", Agencies_Inventory[date]-1)
RETURN
CALCULATE (
SUM(Agencies_Inventory[envase_disponible]),
ALL ( 'Agencies_Inventory' ),
INTERSECT ( ALL ( 'Agencies_Inventory'[date] ), DateFilter )
)
Solved! Go to Solution.
D-1 = 
VAR D = SELECTEDVALUE(Agencies_Inventory[date])
VAR P = CALCULATE(MAX(Agencies_Inventory[date]),ALL ( 'Agencies_Inventory' ),Agencies_Inventory[date]<D)
RETURN CALCULATE (
SUM(Agencies_Inventory[envase_disponible]),
ALL ( 'Agencies_Inventory' ),
,Agencies_Inventory[date]=P
)D-1 = 
VAR D = SELECTEDVALUE(Agencies_Inventory[date])
VAR P = CALCULATE(MAX(Agencies_Inventory[date]),ALL ( 'Agencies_Inventory' ),Agencies_Inventory[date]<D)
RETURN CALCULATE (
SUM(Agencies_Inventory[envase_disponible]),
ALL ( 'Agencies_Inventory' ),
,Agencies_Inventory[date]=P
) 
					
				
				
			
		
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
 
            | User | Count | 
|---|---|
| 84 | |
| 49 | |
| 36 | |
| 31 | |
| 30 |