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
seerauber
Frequent Visitor

Perform Calculations on one row based on values in other rows

EDIT: Correcting 'sample' data - the Record ID for Record Types "Campaign" and "Campaign by Placement" are identical for each Campaign entity; I originally entered each Record ID as unique.

I've searched around some, but unfortunately not quite sure how to even phrase it properly - so my apologies in advance if similar questions have already been asked and answered on the forums! As a little background, I am an intermediate Excel user, but a relative novice to PowerBi and DAX

 

Issue/Question:
We are receiving an excel file with marketing campaign settings data, and we need to use it to create a report that will allow a user to quickly determine the 'maximum' possible bid for a given keyword/campaign/placement. I'll reproduce the basic data structure below, along with our current attempt at a dax measure, and an example of what we are hoping to produce in a powerBi report.

Data structure:

 

 

 

Record IDRecord TypeCampaign IDCampaign NameBidKeyword (string)StrategyPlacementModifier
UniqueID 1CampaignUniqueID 1Ad Campaign Name  Dyn UpAll 
UniqueID 1Campaign By PlacementUniqueID 1Ad Campaign Name   TOS35%
UniqueID 1Campaign By PlacementUniqueID 1Ad Campaign Name   ROS 
UniqueID 1Campaign By PlacementUniqueID 1Ad Campaign Name   PDP0%
UniqueID 2Ad GroupUniqueID 1Ad Campaign Name1.25    
UniqueID 3Ad ProductUniqueID 1Ad Campaign Name     
UniqueID 4KeywordUniqueID 1Ad Campaign Name4keyword 1   
UniqueID 5KeywordUniqueID 1Ad Campaign Name3.87keyword 2   
UniqueID 6KeywordUniqueID 1Ad Campaign Name2.87keyword 3   

 

With the above data, we want to calculate for every Record Type "Keyword" what our maximum possible bid is based on the values in the "Strategy" and "Modifier" columns. The calculation is essentially:

IF "Strategy" = "Dynamic Up" THEN (Bid+(Bid * Modifier) * 2), ELSE (Bid+(Bid * Modifier)

This needs to be performed for each value of the "Campaign By Placement" record for each "Campaign ID" - there will always be three (3) Campaign By Placement records for each unique "Campaign" record.

We have already made something similar to this in Excel, but for a variety of reasons this approach is not tenable as a permanent solution. As a demonstration, this is what we are producing in Excel:

(We have a roughly 1,000 campaigns to perform these calculations for, and the settings data will be updated weekly)

 

For Campaign "Ad Campaign Name" / Campaign ID "UniqueID 1"

StrategyTOSPDPROS 
Dyn Up35%0%0%
KeywordBidMax TOSMax PDPMax ROS
keyword 1$4.00$10.80$8.00$8.00
keyword 2$3.87$10.45$7.74$7.74
keyword 3$2.87$7.75$5.74$5.74


We tried creating the below measure in Powerbi to allow us to pull out the needed data (one for each value we needed extracted) - however it fails because we can't actually associate it back to the Keyword records.

FPTOS Mod =
CALCULATE(
SELECTEDVALUE( 'campaign_settings'[Modifier] ),
'campaign_settings'[Placement] = "TOS"
)


Any guidance or resources that anyone can share with us will be very appreciated!!

1 REPLY 1
seerauber
Frequent Visitor

I can't get the table to format into something easily readable, so adding a screenshot of the same sample data structure in case helpful:

Sample Data Structure:

seerauber_0-1633017920904.png

 

Example of Excel version of desired report:

seerauber_1-1633018145495.png

 

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.

Top Solution Authors