Forum Discussion
stevemdata
3 years agoRegular Visitor
IF Statement based on cell values from multiple columns
Currently I have the following measure for calculating 'engagement': Engagement % = DIVIDE(SUM(DATASET[clicks]),SUM(DATASET [impressions])) DATASET impressions clicks source Impres...
- 3 years ago
stevemdata Sorry Replace this part with "email"
Engagement % = VAR _prct = DIVIDE( SUM('DATASET'[clicks]), SUM('DATASET'[impressions]) ) VAR _media_email = CALCULATE( SUM('DATASET'[clicks]), 'DATASET'[source] = "email") return IF( SELECTEDVALUE('DATASET'[source]) = "email", DIVIDE( _media_email, CALCULATE( SUM('DATASET'[Impressionsv2]), 'DATASET'[source] = "email")),_prct)
stevemdata
3 years agoRegular Visitor
Hi DimaMD thank you!
Unfortunately I made a mistake in my question above, i meant to say if i.e. If source = ‘email’ then engagement should be clicks/impressionsv2, otherwise for all other sources it should be calculated as clicks/impressions.
So in your table the engagement for email row should be 12/34 = 35%
are you able to update your solution please with this in mind? thank you
DimaMD
3 years agoSolution Sage
stevemdata Sorry Replace this part with "email"
Engagement % =
VAR _prct =
DIVIDE(
SUM('DATASET'[clicks]),
SUM('DATASET'[impressions])
)
VAR _media_email = CALCULATE( SUM('DATASET'[clicks]), 'DATASET'[source] = "email")
return
IF( SELECTEDVALUE('DATASET'[source]) = "email", DIVIDE( _media_email, CALCULATE( SUM('DATASET'[Impressionsv2]), 'DATASET'[source] = "email")),_prct)
- stevemdata3 years agoRegular Visitor
perfect! thanks