cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
astrbac Frequent Visitor
Frequent Visitor

How to calculate a "True average" field from two other fields?

Hi all,

 

I have a simple problem: when pulling data from .csv's, in the "Transform" window I do all of my calculations (calculated fields) and in Excel I simply drag and drop Power pivot tables. One of these has a "Return on Ad Spend".

 

Of course, the formula is simple:

Return on investment = Return / Cost

 

The M formula is this one:

if [#"Amount spent"] = 0 
    then 0 
else
Value.Divide(
    Value.Add( 
[Website conversion value], [Mobile app purchases value]), [#"Amount spent (GBP)"] )

 

The rows are calculated correctly, however, totals are not. In my Pivot tables, the average shown is the average of percentages in the calculated field "Return on ad spend", not the average percent (two different things). 

 

How should I go about this? Many thanks

Alex

 

 

 

What is the proper way to mitigate this? Smiley Happy 

 

Many thanks,

Alex

1 REPLY 1
v-cherch-msft Super Contributor
Super Contributor

Re: How to calculate a "True average" field from two other fields?

Hi @astrbac

 

It seems HASONEVALUE Function in dax can help you. If it is not your case, please share some data sample and expected output. You can upload it to OneDrive or Dropbox and post the link here.

How to Get Your Question Answered Quickly

 

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Community Highlights

Community Highlights

Find out what's new in the Power BI Community!

Summit North America

Power Platform Summit North America

Register by September 5 to save $200

Virtual Launch Event

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Users Online
Currently online: 95 members 1,560 guests
Please welcome our newest community members: