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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. 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()))

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.