Forum Discussion
Techyy55
2 years agoNew Member
How to calculate delta inventory value
- Anonymous2 years ago
Hi Techyy55 ,
Please create a Dimdate to help your calculation.
DimDate = ADDCOLUMNS ( CALENDARAUTO (), "Year", YEAR ( [Date] ), "Month", MONTH ( [Date] ), "Day", DAY ( [Date] ), "YearMonth", YEAR ( [Date] ) * 100 + MONTH ( [Date] ) )Data model:
Measure:
Select Date = CALCULATE(SUM('Table'[Value]))Delta Inventory Value = VAR _SELECTMONTH=SELECTEDVALUE(DimDate[Month]) VAR _SELECTDAY = SELECTEDVALUE(DimDate[Day]) RETURN IF(_SELECTMONTH = 2 && _SELECTDAY = 29,BLANK(),CALCULATE([Select Date],SAMEPERIODLASTYEAR(DimDate[Date])))Result is as below.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Techyy55
2 years agoNew Member
If today is Feb 29, 2024 then i want to compare the inventory value on Feb 29, 2023. No, the inventory value is not for each day.
Anonymous
2 years agoNot applicable
Hi Techyy55 ,
Please create a Dimdate to help your calculation.
DimDate =
ADDCOLUMNS (
CALENDARAUTO (),
"Year", YEAR ( [Date] ),
"Month", MONTH ( [Date] ),
"Day", DAY ( [Date] ),
"YearMonth",
YEAR ( [Date] ) * 100
+ MONTH ( [Date] )
)
Data model:
Measure:
Select Date =
CALCULATE(SUM('Table'[Value]))Delta Inventory Value =
VAR _SELECTMONTH=SELECTEDVALUE(DimDate[Month])
VAR _SELECTDAY = SELECTEDVALUE(DimDate[Day])
RETURN
IF(_SELECTMONTH = 2 && _SELECTDAY = 29,BLANK(),CALCULATE([Select Date],SAMEPERIODLASTYEAR(DimDate[Date])))
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.