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
astrbac
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? 🙂 

 

Many thanks,

Alex

1 REPLY 1
v-cherch-msft
Employee
Employee

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
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.