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
BI_Pro
New Member

Multiple What IF Parameter for each row of a matrix visual

Hello! hope all are doing well.
I'm trying to build a matrix visual with multiple what if parameters. The requirement is that each what parameter will be associated with one row. Please refer to the data and matrix view, below. Now the metrix will have Entity as row and Permanent count, Contractor (cont) count and Cont % as Col. Due to some regulation, contractor comes with additional cost (say $100/cont)and if the % of Cont for that entity crosses 50% then further cost (say $400/cont on top of $100) applicable. User wants to know for an entity, if additional contractor is hired then what will be the additional cost. That means one what if parameter for each entity.
I've managed to do it for one entity. But how do I add one more parameter which is associated with Entity 2 and will show the additional cost within same col? Is it practically possible?

Matrix View

PBI.JPG

EntityEmployeeEmployee Type
Entity11001Perm
Entity11002Perm
Entity11003Perm
Entity11004Perm
Entity11005Perm
Entity11006Perm
Entity11007Cont
Entity11008Cont
Entity11009Cont
Entity11010Cont
Entity21011Perm
Entity21012Perm
Entity21013Perm
Entity21014Perm
Entity21015Cont
Entity21016Cont
Entity21017Cont
Entity21018Cont

 

 

 

 

2 ACCEPTED SOLUTIONS
v-yangliu-msft
Community Support
Community Support

Hi  @BI_Pro ,

Here are the steps you can follow:

1. Use New Parameter to create two parameters

vyangliumsft_0-1627435119140.png

2. Create measure.

extra cont cost =
var _para1=SELECTEDVALUE(Parameter[Parameter])
var _para2=SELECTEDVALUE('Parameter2'[Parameter2])
return
IF(MAX('Table'[Entity])="Entity1",
    IF(
    [Cont%]<0.5,
   ( _para1+[Cont Total])*100,
   400/( _para1+[Cont Total])+100),
   IF(
    [Cont%]<0.5,
   ( _para2+[Cont Total])*100,
   400/( _para2+[Cont Total])+100))

3. Result:

When Parameter is set to 3, it is displayed as 700 in Entity1, and there is no change in Entity2.

vyangliumsft_1-1627435119142.png

When Parameter2 is set to 4, there is no change in Entity1, and Entity2 is displayed as 150.

vyangliumsft_2-1627435119144.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

Thanks v-yangliu-msft. 

I was thinking about something similar but unable to nail it down

View solution in original post

4 REPLIES 4
v-yangliu-msft
Community Support
Community Support

Hi  @BI_Pro ,

Here are the steps you can follow:

1. Use New Parameter to create two parameters

vyangliumsft_0-1627435119140.png

2. Create measure.

extra cont cost =
var _para1=SELECTEDVALUE(Parameter[Parameter])
var _para2=SELECTEDVALUE('Parameter2'[Parameter2])
return
IF(MAX('Table'[Entity])="Entity1",
    IF(
    [Cont%]<0.5,
   ( _para1+[Cont Total])*100,
   400/( _para1+[Cont Total])+100),
   IF(
    [Cont%]<0.5,
   ( _para2+[Cont Total])*100,
   400/( _para2+[Cont Total])+100))

3. Result:

When Parameter is set to 3, it is displayed as 700 in Entity1, and there is no change in Entity2.

vyangliumsft_1-1627435119142.png

When Parameter2 is set to 4, there is no change in Entity1, and Entity2 is displayed as 150.

vyangliumsft_2-1627435119144.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Thanks v-yangliu-msft. 

I was thinking about something similar but unable to nail it down

TomMartens
Super User
Super User

Hey @BI_Pro ,

 

I recommend that you have a closer look to data modeling with Power BI: Model data in Power BI - Learn | Microsoft Docs

Without understanding the requirements completely, I would recommend creating an Entity table that stores additional information about the specific entity. Relate this table to your existing table.

 

Create a measure that iterates across the entities, inside each iteration you can access the specific entity information.

 

You might want to avoid data modeling (even if it's considered best practice to start with a sound data model) you can create a DAX that looks like this.

 

meassure 1 =

SUMX(
    'table'
    , var __Entity = 'table'[Entity]
    return
    SWITCH( __Entity
        "Entity1" , CALCULATE( ... )
        , "Entity2" , CALCULATE( ... )
    )
)

Hopefully, this provides something that will help to tackle your challenge.

 

Regards,

Tom

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Thanks. Individual what if parameter is working (for each row) but I'm not getting the desire result for the calculation. It's getting multiplied by the number of rows per entity i.e. if the desire result of the calculation for Entity1 is 100 then i'm getting 1000. It's because there are 10 employees under Entity1. 

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.