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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Thigs
Helper III
Helper III

Projection based on numeric parameters

Hi all!

I've been charged with creating a flexible business case tool, where the business users can input some items, get a cost, use a growth rate, and see how much it would cost year over year. 

 

I have the formula to get the total original cost, which I have called [Total Year 1 Costs]. I also have a numeric parameter that allows the user to select a growth rate (between 0.01 - 0.5) for the annual growth rate. I'm trying to allow them to also select the start year for the project ("Go Live Year"). The individual variables are working, but my switch formula is not. Any assistance is greatly appreciated!

 

Growing the Cost =
VAR Growth = (1+SELECTEDVALUE('Annual Growth Rate'[Annual Growth Rate]))
VAR BaseYear = [Total Year 1 Costs]
VAR Year1 = [Total Year 1 Costs]*Growth
VAR Year2 = Year1*Growth
VAR Year3 = Year2*Growth
VAR Year4 = Year3*Growth
VAR Year5 = Year4*Growth
VAR Year6 = Year5*Growth
VAR Year7 = Year6*Growth
VAR Year8 = Year7*Growth
VAR Year9 = Year8*Growth
VAR Year10 = Year9*Growth
VAR Year11 = Year10*Growth

RETURN
SWITCH(TRUE(),
MAX(Years[Years]) = SELECTEDVALUE('Go Live Year'[Go Live Year]), BaseYear,
MAX(Years[Years]) = SELECTEDVALUE('Go Live Year'[Go Live Year])+1, Year1,
MAX(Years[Years]) = SELECTEDVALUE('Go Live Year'[Go Live Year])+2, Year2,
MAX(Years[Years]) = SELECTEDVALUE('Go Live Year'[Go Live Year])+3, Year3,
MAX(Years[Years]) = SELECTEDVALUE('Go Live Year'[Go Live Year])+4, Year4,
MAX(Years[Years]) = SELECTEDVALUE('Go Live Year'[Go Live Year])+5, Year5


)
6 REPLIES 6
FBergamaschi
Solution Sage
Solution Sage

I agree, the problem must be here

 

MAX(Years[Years]) = SELECTEDVALUE('Go Live Year'[Go Live Year]), BaseYear,
MAX(Years[Years]) = SELECTEDVALUE('Go Live Year'[Go Live Year])+1Year1,
MAX(Years[Years]) = SELECTEDVALUE('Go Live Year'[Go Live Year])+2Year2,
MAX(Years[Years]) = SELECTEDVALUE('Go Live Year'[Go Live Year])+3Year3,
MAX(Years[Years]) = SELECTEDVALUE('Go Live Year'[Go Live Year])+4Year4,
MAX(Years[Years]) = SELECTEDVALUE('Go Live Year'[Go Live Year])+5Year5
 
I assume the SELECTEDVALUE part is returning a blank as it finds more values, please turn it into
 
MAX(Years[Years]) = SELECTEDVALUE('Go Live Year'[Go Live Year], -1), BaseYear,
MAX(Years[Years]) = SELECTEDVALUE('Go Live Year'[Go Live Year], -1)+1Year1,
MAX(Years[Years]) = SELECTEDVALUE('Go Live Year'[Go Live Year], -1)+2Year2,
MAX(Years[Years]) = SELECTEDVALUE('Go Live Year'[Go Live Year], -1)+3Year3,
MAX(Years[Years]) = SELECTEDVALUE('Go Live Year'[Go Live Year], -1)+4Year4,
MAX(Years[Years]) = SELECTEDVALUE('Go Live Year'[Go Live Year], -1)+5Year5
 
and try again, I expect some values now. But please turn the graph into a table, I want to see nrs
 
To understand why SELECTEDVALUE does not find a single value, in case my intuition is correct, I need to see the tables and the model
 

If this helped, please consider giving kudos and mark as a solution

@me in replies or I'll lose your thread

Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page

Consider voting this Power BI idea

Francesco Bergamaschi

MBA, M.Eng, M.Econ, Professor of BI

FBergamaschi
Solution Sage
Solution Sage

Can you provide some images of what you mean by "not working"?

No data is appearing within the graph. I am using a line chart, using Years as my X-axis (not "Go Live" year, but a year table that has one column, Years, from 2025 - 2100). I then pull the measure into the Y axis and nothing occurs. 

I need to see columns grouped in rows amd columns section of the visual, the selection on slicers, need to see the data model

 

Without contexts and Data model I cannot understand the issue

I've attached three images. The top is my visual, you can see that it is blank. The Total Year 1 Costs formula IS giving a result (it's in the box), and when I return any variable, that is giving me a correct result, so it is an issue with the SWITCH statement at the end. 

There isn't really any raw data within this file - it is all based on numeric parameters and formulas. 

The visual, on the left, is blankThe visual, on the left, is blankThis is the "Years" data, created by numeric parameterThis is the "Years" data, created by numeric parameterThis is the Growing the Cost formulaThis is the Growing the Cost formula

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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