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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Employee
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
Employee
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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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