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
Anonymous
Not applicable

Calculating number of events based on a condition in another datasheet

Hey community,

 

I'm running into an issue when creating new calculated columns.

 

Example

So for my example I'm reviewing campaign results. So for every campaign we've had a certain media cost and sales amount (number of products sold). Basically we're calculating cost of goods sold in order to determine the added value of the media campaign.

 

What do I have?

I have 2 datasheets:

- 1 containing delivery data (media cost/sales amount etc. per day)

- 1 containing metadata (campaign name, goal, budget etc.)

 

What do I want?

I want to check whether a campaign is performing below or above the goal on a certain date based on cumulative values (so Average Cost/Sales to date). Then I want to show how many campaigns are reaching their goal and how many are not. So basically I want to check if the value of the Average Cost/Sales to date on a certain date is below the value of Goal on another data sheet (linked by campaign ID). If it's smaller or equal than the goal I want it to show a "1", so I can sum these up later. This would be the Positive_goal column. In another column I want to show a "1" when it's higher than the goal. This would be the Negative_goal column. This way I could select a certain time span and show a bar chart to show how many campaigns are reaching their goal.

 

I already tried this:

Positive_goal = if(Final_delivery[Average Cost/Sales to date]<=LOOKUPVALUE(Final_metadata[Goal];Final_metadata[campaignid];Final_delivery[campaignid]);1;0)

 

Negative goal = if(Final_delivery[Average Cost/Sales to date]>LOOKUPVALUE(Final_metadata[Goal];Final_metadata[campaignid];Final_delivery[campaignid]);1;0)

 

The first one works, but when I want to create the second column PowerBI tells me there's a circular dependency and it cannot create the new column. Can anybody help me find another way to achieve this?

 

Thanks in advance

 

 

1 ACCEPTED SOLUTION
Mi2n
Employee
Employee

On quick glance, I guess the Related() function would help instead of the Lookupvalue() function.

View solution in original post

2 REPLIES 2
Mi2n
Employee
Employee

On quick glance, I guess the Related() function would help instead of the Lookupvalue() function.

Anonymous
Not applicable

Thanks so much,

 

this solves it Smiley Happy

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.