The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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.
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?
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.
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.
Feb 2023 has 28 days. Now what? Share some data to work with and show the expected result.
User | Count |
---|---|
74 | |
70 | |
39 | |
30 | |
28 |
User | Count |
---|---|
104 | |
95 | |
51 | |
48 | |
46 |