Forum Discussion
glennkobes
5 years agoNew Member
repost: Wine Inventory
Hi, This is a repost as I have not yet found a solution. Orignal post. I also have the link to the file (here). My main issue is that I have a measure to get the latest date for which there is a "...
- 5 years ago
Make sure you assign the date in 'Last Set Date In Context' field to a variable.
Then add the variable to the measure:
Measure = VAR _Last_Set_Date_In_Context = MAX(WineLog[Bottles]) RETURN SUMX( WineList, CALCULATE( sum(WineLog[Bottles])*-1, WineLogtt[Transaction Type] = "Take", filter( 'Calendar','Calendar'[date] >= _Last_Set_Date_In_Context)))
themistoklis
Community Champion
5 years ago
Make sure you assign the date in 'Last Set Date In Context' field to a variable.
Then add the variable to the measure:
Measure =
VAR _Last_Set_Date_In_Context = MAX(WineLog[Bottles])
RETURN
SUMX(
WineList,
CALCULATE(
sum(WineLog[Bottles])*-1,
WineLogtt[Transaction Type] = "Take",
filter( 'Calendar','Calendar'[date] >= _Last_Set_Date_In_Context)))
- glennkobes5 years agoNew Member
Thanks themistoklis! This helped alot! I also discovered that I could use the Datesbetween function to get the proper date range. Below is the formula for the measure that returned the correct value.
Thanks again for your help!
=VAR _Last_Set_Date_In_Context = [Last Set Date In Context]
RETURN
SUMX(
WineList,
CALCULATE(
SUM( WineLog[Bottles] ) * -1,
WineLogtt[Transaction Type] = "Take",
DATESBETWEEN(
'Calendar'[Date],
_Last_Set_Date_In_Context,
MAX( 'Calendar'[Date] )
)
)
)