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
dan_martin
New Member

DIVIDE different number denominators

Hi all,

 

I need to return the accurate values,  my table is build with 4 different measures. I need to calculate an average, but, as you see for 3 columns I have no value in the first column, so the denominator should be 2 and the correct value 100%.

 

My dax is a basic formula:  Average = (value1+value2+value3) / 3. 

 

dan_martin_1-1656651317450.png

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Thank you Jihwan Kim, it worked!

View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your data model looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

All measures are in the attached pbix file.

 

Untitled.png

 

 

Average expected percent: = 
VAR _onepercenttable =
    ADDCOLUMNS (
        VALUES ( Data[Name] ),
        "@one percent", [Trial one percent measure:]
    )
VAR _twopercenttable =
    ADDCOLUMNS (
        VALUES ( Data[Name] ),
        "@two percent", [Trial two percent measure:]
    )
VAR _threepercenttable =
    ADDCOLUMNS (
        VALUES ( Data[Name] ),
        "@three percent", [Trial three percent measure:]
    )
VAR _uniontables =
    SELECTCOLUMNS (
        UNION ( _onepercenttable, _twopercenttable, _threepercenttable ),
        "@Name", Data[Name],
        "@percent", [@one percent]
    )
RETURN
    AVERAGEX ( _uniontables, [@percent] )

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Thank you Jihwan Kim, it worked!

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.