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
lefinalzugzwang
Frequent Visitor

Creating a YTD measure that doesn't filter by month

power BI screenshot.png

I am having some trouble with getting a measure to behave the way that I want it to. I have attached a screenshot for context. Basically it is a production plan of when my company are bringing stock in of a certain item (which has been filtered using the standard filter tab at the side of the report). The measure I am having trouble to create is STOCK BUILD.

Stock Build is equal to the stock in the building, plus what has already been sold so far in the year, plus stock that has been ordered but hasn't yet arrived. 

Stock Build = sum(Stocks[Stock.InStock])+
IF(
ISFILTERED('Dates'[Date]),
ERROR("Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy."),
TOTALYTD(SUM('ETAs'[Quantity]), 'Dates'[Date].[Date])
)+8766

Sales Measure = TOTALYTD(sum(Sales[Sale.Volume]),Dates[Date])

The last term in 'Stock Build' is 8766. The reason is that this is the volume of product 'Gooey Louie' we have sold YTD. So what I need in its place is a YTD sales volume measure, that can be filtered by product, but is not filtered by date e.g. when in a table with months as rows... I want it to be 8766 (or whatever the YTD sales is for the product) regardless of what date filters are implicit in choice of visual.

I do hope that I have managed to articulate my question. I've found this to be very tricky.

1 ACCEPTED SOLUTION
v-sihou-msft
Microsoft Employee
Microsoft Employee

@lefinalzugzwang

 

According to your description, you want to have your Sales Measure to ignore the month filter so that it will always show Year Total Sales instead of YTD Sales. Right?

 

If so, you just create a Year column in your date table.

 

Year = YEAR(Dates[Date])

Then use ALLEXCEPT() to group the calculation on Year.

 

 

Sales Measure = CALCULATE(SUM(Sales[Sale.Volume]),ALLEXCEPT(Dates,Dates[Year]))

Regards,

 

View solution in original post

1 REPLY 1
v-sihou-msft
Microsoft Employee
Microsoft Employee

@lefinalzugzwang

 

According to your description, you want to have your Sales Measure to ignore the month filter so that it will always show Year Total Sales instead of YTD Sales. Right?

 

If so, you just create a Year column in your date table.

 

Year = YEAR(Dates[Date])

Then use ALLEXCEPT() to group the calculation on Year.

 

 

Sales Measure = CALCULATE(SUM(Sales[Sale.Volume]),ALLEXCEPT(Dates,Dates[Year]))

Regards,

 

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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