Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.