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
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
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.