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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
andreazambon
Helper V
Helper V

Rolling YTD measure using fields with category

Hi there. 

 

I've used this (9) Power BI Show Year-to-Date (YTD) Across Multiple Years - YouTube by Avi Singh to build a measure which calculates the Rolling YTD sum of kg porduced. 

The formula is:

 

 

 

qty_kg_ROLYTD = VAR MaxMonthYTD = [This Month for YTD]
RETURN calculate(sum(SAPProdConfirmation[qty_kg]), DateTable[month]=MaxMonthYTD)

 

 

 

where "This Month for YTD is":

 

 

 

This Month for YTD = calculate(MAX(DateTable[month]), ALL(DateTable),(DateTable[MonthOffset]=0))

 

 

 

My dataset can manage that but I have a category for each row of quantity, which says if the quantity declared is scrap or good. 

For example:

 

qty_kgquality_status
1000scrap
2000scrap
3000good
4000good
5000good

 

 

The measure I've built does not fit with the quality status assignment, as you can see:

andreazambon_0-1705071367056.png

 

 

Actually I'm not surprise, but I need to fix this without creating a measure for each quality status value, I want to manage it in a single measure. 

 

Do you have any suggestion? Thanks.

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

I'd expect your measure to work fine as long as the quality_status column is also from SAPProdConfirmation or a table that filters that fact table via a relationship.

 

Can you confirm the quality is not coming from a disconnected table or a table that doesn't filter SAPProdConfirmation via a relationship?

View solution in original post

2 REPLIES 2
AlexisOlson
Super User
Super User

I'd expect your measure to work fine as long as the quality_status column is also from SAPProdConfirmation or a table that filters that fact table via a relationship.

 

Can you confirm the quality is not coming from a disconnected table or a table that doesn't filter SAPProdConfirmation via a relationship?

Actually, it is like you supposed and it works fine. 

 

I don't know why, probably I miss something in the original formula... nevermind. Thanks for answer.

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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