Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Techyy55
New Member

How to calculate delta inventory value

 
1 ACCEPTED SOLUTION
Anonymous
Not 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:

vrzhoumsft_0-1700536663969.png

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.

vrzhoumsft_1-1700536701686.pngvrzhoumsft_2-1700536749999.png

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.

 

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

If today was Feb 29, 2024, then with which date of the previous year would you want to compare the inventory value of today?  Also, is there an inventory value for each day of 2022 and 2023?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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
Not 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:

vrzhoumsft_0-1700536663969.png

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.

vrzhoumsft_1-1700536701686.pngvrzhoumsft_2-1700536749999.png

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.

 

Feb 2023 has 28 days.  Now what?  Share some data to work with and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.