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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
AspireAlex
Frequent Visitor

Combining multiple 'What Ifs'

Hi,

 

I'm trying to create a model to analyse costs of our IT Service Desk using the new What If functionality to input hourly costs via sliders. I therefore need to calculate either [Time Taken] x [1st Line Support WhatIf Value] [Measure 1] or [Time Taken] x [2nd Line Support WhatIf Value] [Measure 2] depending upon which tier of support dealt with the request.

 

Measures [1] and [2] work fine in isolation however I am struggling as soon as I introduce an IF statement to conditionally select the WhatIf value.  I've tried adding a calculated column onthe original data source which looks like this:

 

Cost = IF(Data[Position] = "1st Line", WhatIf_1stLineCost[WhatIfParam1 Value], WhatIf_2ndLineCost[WhatIfParam2 Value])

 

As soon as I do this the values are blank.

 

Any suggestions on how to achieve this?  It seems like such a simple problem.  See below for an example of what I need the data to display like, the values in red is what I am trying to achieve.

 

whatif.png

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @AspireAlex,

 

You can refer to below sample to use position to switch the line value.

Measure = 
var currentPosition=LASTNONBLANK(Table1[Position],[Position])
return
MAX(Table1[Time Token])*SWITCH(currentPosition,"Line 1",MAXX(VALUES('Select 1'[Line 1]),[Line 1]),"Line 2",MAXX(VALUES('Select 2'[Line 2]),[Line 2]))

7.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

Hi @AspireAlex,

 

You can refer to below sample to use position to switch the line value.

Measure = 
var currentPosition=LASTNONBLANK(Table1[Position],[Position])
return
MAX(Table1[Time Token])*SWITCH(currentPosition,"Line 1",MAXX(VALUES('Select 1'[Line 1]),[Line 1]),"Line 2",MAXX(VALUES('Select 2'[Line 2]),[Line 2]))

7.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi Xiaoxin,

 

Thanks for your advice, I've managed to get it working now that I've created the CurrentPosition measure.

 

Alex

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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