Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi,
Share some data to work with and show the expected result. Share data in a format that can be pasted in an MS Excel file.
Hi @Hussein_charif - you can adjust the logic to correctly get data from DateOnly - 1 and below, without including incorrect earlier dates (such as the one you mentioned, which was not what you expected)
modified measure:
CostPerQuantity_ExcludeLastDate =
VAR LastDateSelected = MAX('valueEntry'[DateOnly])
VAR DateToFilter = LastDateSelected - 1
VAR SumCost =
SUMX(
FILTER(
'valueEntry',
'valueEntry'[DateOnly] <= DateToFilter
),
'valueEntry'[cost]
)
VAR SumQuantity =
SUMX(
FILTER(
'valueEntry',
'valueEntry'[DateOnly] <= DateToFilter
),
'valueEntry'[itemLedgerEntryQuantity]
)
RETURN
IF(
ISBLANK(DIVIDE(SumCost, SumQuantity)),
0,
DIVIDE(SumCost, SumQuantity, 0)
)
Hope this helps
Proud to be a Super User! | |
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 101 | |
| 76 | |
| 56 | |
| 51 | |
| 46 |