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
Anonymous
Not applicable

Calculating Variance and Counting Projects where variance exceeds a threshold

Hi,

 

I am currently working on a project where we are looking to calculate variance based on the current phase of a project.  The phase of the project will determine which field we will use to calculate variance.  We then want to count how many projects have a variance of -25% or less for a card visual.

 

Here is the DAX measure I am using to calculate variance: 

Variance = SWITCH(TRUE(),
SELECTEDVALUE('Project_Dimension'[Current_Phase]) in {"Analyze", "Design", "Build", "Test", "Deploy", "Warranty" }, DIVIDE((SUM('Project_Financial_Measures'[Total Cost Original BC]) - SUM('Project_Financial_Measures'[Total Cost Actual Forecast])),SUM('Project_Financial_Measures'[Total Cost Original BC])),
DIVIDE((SUM('Project_Financial_Measures'[Total Cost Planning Exit]) - SUM('Project_Financial_Measures'[Total Cost Actual Forecast])),(SUM('Project_Financial_Measures'[Total Cost Planning Exit]))))
 
Here's the DAX I've tried to count the projects who have a variance of -25% or less (which is not working, only returns '(Blank)' in my card visual:
Var Count = CALCULATE(DISTINCTCOUNT(Project_Financial_Measures[Project_Name]),FILTER(Project_Financial_Measures, 'Project_Financial_Measures'[Variance] <= -.25))
 
And here's the data:
Project_NameCurrent_PhaseTotal Cost Original BCTotal Cost Planning ExitTotal Cost Actual ForecastVariance
ABuild592521.05460114.01282297.4252%
BTest1343921.3701967024.76-46%
CBuild546309.742179285.312229822.96-308%
DTest4284925.7305044821.18-18%
ETest462841.29406979.68465773.78-1%
FBuild001763135.35 
GWarranty00139069.15 
HBuild1201453.521386096.592335053.08-94%
IDeploy2793309.92376018.522305232.7717%
JWarranty5661652.6302910610.6849%
KDeploy2959146.8401395860.1853%
LAnalyze283818.260364650.3-28%
MWarranty734891.710480726.6735%
NAnalyze840096.090701790.3716%
OAnalyze1132573.2901254232.61-11%
PBuild13587750.45019104613.89-41%
QBuild488215.131517078.091702372.68-249%
RUnassigned602142.610580180.06 
SAnalyze605978.110576400.185%
TDesign2125887.6702231014.99-5%
UWarranty946499.530460891.451%
VUnassigned198973.850151644.86 
WDeploy1237756103480023.2472%
XAnalyze105487.1706561280.02-6120%
UDeploy772233.79559127.35634068.5318%
ZWarranty1982269.60352243.2382%
AADesign1017186.4304309828.23-324%

 

Any help would be greatly appreciated, thank you in advance!

 

-Jackson

1 ACCEPTED SOLUTION
wdx223_Daniel
Super User
Super User

@Anonymous 

Var Count = CALCULATE(DISTINCTCOUNT(Project_Financial_Measures[Project_Name]),FILTER(SUMMARIZE(Project_Financial_Measures, Project_Financial_Measures[Project_Name],'Project_Dimension'[Current_Phase]),'Project_Financial_Measures'[Variance] <= -.25))

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Try a measure

countx(values(Table[Project_Name]), if([Variance]>-.25, [Variance], blank()))

or

Sumx(values(Table[Project_Name]), if([Variance]>-.25, 1, blank()))

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
wdx223_Daniel
Super User
Super User

@Anonymous 

Var Count = CALCULATE(DISTINCTCOUNT(Project_Financial_Measures[Project_Name]),FILTER(SUMMARIZE(Project_Financial_Measures, Project_Financial_Measures[Project_Name],'Project_Dimension'[Current_Phase]),'Project_Financial_Measures'[Variance] <= -.25))

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

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

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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.