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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
wlaughl
Regular Visitor

How to aggregate project variances and do calcs at the project category level

Hello, I have a table that includes project-level data, as well as a field for Project Category. I also have a measures table with Forecasted Spend and Actual Spend. Both tables are in a PBI dataset using Direct Query mode. 

 

I want to do the following:

- Aggregate Forecasted Spend and Actual Spend at the Project Category level, instead of the Project level

- Calculate the % difference between Forecasted Spend and Actual Spend, again at the Project Category level

- Evaluate each Project Category's % difference between Forecasted Spend and Actual Spend, to determine which Project Category met a +/- 5% threshold

- Calculate # and % of Project Categories that met/did not meet the target threshold

- Be able to filter on Project Categories that met/did not meet the target threshold

 

I considered building a summary table with SUMMARIZECOLUMNS to aggregate the data to the Project Category level, but I understand that credentials issues can cause issues with data refresh in the Power BI service using DirectQuery mode. 

 

Thanks in advance for the guidance! 

2 REPLIES 2
wlaughl
Regular Visitor

Thank you @Amit I was able to create that measure successfully. However it only gives me a "1" for each project category that met the +/-5% criteria in a tabular visual. How do I write a measure/column that will add up all those 1's to get a total number of projects that met the criteria, and then divide that # by the total # of projects to get a % Met? Thanks! 

amitchandak
Super User
Super User

@wlaughl , You need measure like below one, you can use summarize in place of values , assumed - Spend and forecast measure

 

var _diff =divide(abs([Forecast]-[Spend]),[Forecast])
return
Countx(filter( Values([Project Category]) , _diff<=.05),[Project Category])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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
Top Kudoed Authors