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

Average If condition

Hi All,

 

What can I use instaead to  MAX in the below measure to calculate Average based on some conditions:

 

Measure = IF(MAX(View_DealClosing[Unit] = "DTH"),
CALCULATE(AVERAGE(View_DealClosing[PrimaryAdder])*0.1),
CALCULATE(AVERAGE(View_DealClosing[PrimaryAdder])))
 
Himanshu_13_1-1661266055378.png

 

Regards,

Himanshu

1 ACCEPTED SOLUTION
PabloDeheza
Solution Sage
Solution Sage

Hi there!

MAX is returning an error because you are closing the braket after the condition, you should close the MAX braket right after the column. It would look like this:

Measure = IF(MAX(View_DealClosing[Unit]) = "DTH",
CALCULATE(AVERAGE(View_DealClosing[PrimaryAdder])*0.1),
CALCULATE(AVERAGE(View_DealClosing[PrimaryAdder])))
Let me know if that solves your problem!

View solution in original post

2 REPLIES 2
nvprasad
Solution Sage
Solution Sage

Hi 

 

Your Question & Dax is not clear. However my assumption is if user selects DTH then you want to multiply with 0.1 else you want to take average.

Dax = IF ( SELECTEDVALUE(View_Dealclosing[Unit]) = "DTH",

                   AVERAGE(View_Dealclosing[PrimaryAdder])*0.1,

                   AVERAGE(View_Dealclosing[PrimaryAdder]))

 

Appreciate a Kudos! ‌‌
If this helps and resolves the issue, please mark it as a Solution! ‌‌

Regards,
N V Durga Prasad

PabloDeheza
Solution Sage
Solution Sage

Hi there!

MAX is returning an error because you are closing the braket after the condition, you should close the MAX braket right after the column. It would look like this:

Measure = IF(MAX(View_DealClosing[Unit]) = "DTH",
CALCULATE(AVERAGE(View_DealClosing[PrimaryAdder])*0.1),
CALCULATE(AVERAGE(View_DealClosing[PrimaryAdder])))
Let me know if that solves your problem!

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.