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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Hussein_charif
Helper IV
Helper IV

sum of all dates except last day on slicer

 
2 REPLIES 2
Ashish_Mathur
Super User
Super User

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.


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

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





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors