Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Helper I
Helper I

Dynamic Calculated Measure



I have two tables below one from salesforce - opportunity and one from excel 




I wanted to create a dynamic measure base on a slicer which will be from the excel table and multiply the value to the opportunity table 


so for example, if the slicer is set to commodities at 2/5/2021 then I want the equation for 2021 assumption to multiply the filtered values :


if ('Opportunity'[Commit_Upside__c] = "Booked", 'Opportunity'[ToUSD-Positive-License_Cost__C] * sum('2021-Assumptions'[Booked%]),
if ('Opportunity'[Commit_Upside__c] = "Commit", 'Opportunity'[ToUSD-Positive-License_Cost__C] * sum('2021-Assumptions'[Commit%]),
if ('Opportunity'[Commit_Upside__c] = "Upside", 'Opportunity'[ToUSD-Positive-License_Cost__C] * sum('2021-Assumptions'[Upside%]),
if ('Opportunity'[Commit_Upside__c] = "Potential", 'Opportunity'[ToUSD-Positive-License_Cost__C] * sum('2021-Assumptions'[Potential%]),
if ('Opportunity'[Commit_Upside__c] = "Pipeline", 'Opportunity'[ToUSD-Positive-License_Cost__C] * sum('2021-Assumptions'[Pipeline%]), 0)


Is it possible?


So far Ive gotten to

Division Factor =
VAR SelectedDivision = SELECTEDVALUE( '2021 Assumptions'[Division] )
VAR SelectedDate = SELECTEDVALUE( '2021 Assumptions'[Date] )
VAR myFilteredTable =
'2021 Assumptions',
'2021 Assumptions'[Date] = SelectedDate,
'2021 Assumptions'[Division] = SelectedDivision
SUMX( myFilteredTable, if (CALCULATETABLE(Opportunity,Opportunity[Commit_Upside__c]) = "Booked"), SUM('Opportunity'[Positive_Services_Amount__c USD]) * sum('2021 Assumptions'[Booked%]),
if (CALCULATETABLE(Opportunity,Opportunity[Commit_Upside__c] = "Commit"), SUM('Opportunity'[Positive_Services_Amount__c USD]) * sum('2021 Assumptions'[Commit%]),
if (CALCULATETABLE(Opportunity,Opportunity[Commit_Upside__c] = "Upside"), SUM('Opportunity'[Positive_Services_Amount__c USD]) * sum('2021 Assumptions'[Upside%]),
if (CALCULATETABLE(Opportunity,Opportunity[Commit_Upside__c] = "Potential"), SUM('Opportunity'[Positive_Services_Amount__c USD]) * sum('2021 Assumptions'[Potential%]),
if (CALCULATETABLE(Opportunity,Opportunity[Commit_Upside__c] = "Pipeline"), SUM('Opportunity'[Positive_Services_Amount__c USD]) * sum('2021 Assumptions'[Pipeline%]), 0)
But this doesn't seem to work.

Thanks so much in advance

Super User
Super User

@powerbiwork First, use a SWITCH or SWITCH(TRUE()...) statement instead of IF statements. Second, seems like you would want to base that SWITCH statement on the value in your slicer, SelectedDivision 

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler  thank you I will give that a try.



Helpful resources

PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors