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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

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()))

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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