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

Calculate Sum of Values Based on Date and Product Type for filtering

Hello,

 

I need some guidance, I currently have a data table visual that is pulling the following information where the ‘Change’ calculated column = Sum of the current 'Received' value + any <= previous post date 'Received'values. Now, my issue here is that when I filter by ‘project type’ (using page filter), the ‘Change’ values are accounting for any previous post-date values regardless of the project type. How do I set it up to only calculate the Sum of all ‘Received’ units + any ‘Received’ units with the same project type that have a post-date that is =< than the current row’s post-date?

 

To give additional details about my setup, I have 3 data tables: ProjectID, Goals, and Services. The data table ProjectID has a relationship with both the goals and service tables based on the data [ProjectID] that is linking them all together. 

1 ACCEPTED SOLUTION

@v-rzhou-msft Hi! Thank you for reaching out to assist. I was able to figure it out by using the following:

Calculate(SUM(Services[Received]),Filter(All(Services[PostDate]),Services[PostDate] <= MAX(Services[PostDate])),Filter(All(Services[Status]),Services[Status] = "Completed"))

View solution in original post

3 REPLIES 3
v-rzhou-msft
Community Support
Community Support

Hi @Palan22 

Could you provide me a sample without sensitive data by your Onedrive for Business?

And show me your calculate logic to me.

It is better to show me a screenshot of the result you want.

This will make it easier for me to understand your requirement.

 

Best Regards,

Rico Zhou

@v-rzhou-msft Hi! Thank you for reaching out to assist. I was able to figure it out by using the following:

Calculate(SUM(Services[Received]),Filter(All(Services[PostDate]),Services[PostDate] <= MAX(Services[PostDate])),Filter(All(Services[Status]),Services[Status] = "Completed"))
parry2k
Super User
Super User

@Palan22 Read this post to get your answer quickly.

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

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.