+ Reply to Thread
Results 1 to 9 of 9

Help to write a DAX measure to average three columns ignoring blanks

  1. #1
    Forum Contributor
    Join Date
    06-17-2014
    Location
    london
    MS-Off Ver
    365
    Posts
    398

    Help to write a DAX measure to average three columns ignoring blanks

    Hi All

    I was wondering whether someone can help me with the following problem

    I have a powerpivot and have created three measure using RANKX. These measures are called Rank1, Rank2 and Rank3. In these measure if cells are blank the rank will return a blank row i.e. it doesn't count it in the ranking.

    What I need to do is crate another measure to add (Rank1 + Rank2 + Rank3) /3 but this measure doesn't seem to work of rows in Rank1 2 or 3 contain a blank, It returns a wrong value

    What I want is a DAX measure to calculate Sum of (Rank1,2 and 3)/3 in table Employees and if any of the have a Blank, then ignores them i.e. if rank1 = Blank, Rank2=2 and Rank3=3 then it will just add (2+3)/2 and ignore rank1. but if rank1=2, rank2=3 and rank3=4 then the formula should be(2+3+4)/3, in other words I want to find the average of Rank1,2 and 3 and ignoring the blank cells.

    I hope this makes sense, I've tried everything and I can seem to get a right answer.

    any help is appreciate it

  2. #2
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Help to write a DAX measure to average three columns ignoring blanks

    You mean (Rank1 + Rank2 + Rank3) /3 as AVERAGE? If yes try with DAX: AVERAGEA()

  3. #3
    Forum Contributor
    Join Date
    06-17-2014
    Location
    london
    MS-Off Ver
    365
    Posts
    398

    Re: Help to write a DAX measure to average three columns ignoring blanks

    Thanks for this. I will try this. Would this ignore blanks? I have not used AverageA before is cry's syntax averagea(table name, rank1,rank2,rank3)?

    Thanks again

  4. #4
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Help to write a DAX measure to average three columns ignoring blanks

    In DAX you can use table (i.e. 3 columns) and AVERAGEA(), read more here AVERAGEA. And Yes it will ignore 0, blank etc.

    more here

    edit:
    maybe something like this:
    =AVERAGEA((Sales[Sum of rank1]), Sales[Sum of rank2], Sales[Sum of rank3])
    if you want Average values, you can try
    =AVERAGEA(VALUES[rank1],VALUES[rank2],VALUES[rank3])
    but I am not sure
    Last edited by sandy666; 04-19-2016 at 02:11 PM.

  5. #5
    Forum Contributor
    Join Date
    06-17-2014
    Location
    london
    MS-Off Ver
    365
    Posts
    398

    Re: Help to write a DAX measure to average three columns ignoring blanks

    Hi Sandy666
    I tried this and I get eh following error
    Too many arguments were passed to the AVERAGEA function. The maximum argument count for the function is 1.

    I put in averagea('table1'[Rank1],'table2'[rank2],'table3'[rank3])

    my pivot table is like below (simple example)
    Name Rank1 rank2 rank3
    aaa 2 4
    bbb 4 7 8
    ccc 9 3

    my three tables table1,2 & 3 are all have a relation with name table.
    I get the names from name and rank1 from table1, rank2 from table2 and so on

    Can I use more than one argument in averagea?

    thanks again for your help

  6. #6
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Help to write a DAX measure to average three columns ignoring blanks

    I don't like DAX language but you can try read here: DAX: Statistical Functions

  7. #7
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Help to write a DAX measure to average three columns ignoring blanks

    I tried and got one conclusion
    Vmeasure1: AVERAGEA() of rank1 = result1
    Vmeasure2: AVERAGEA() of rank2 = result2
    Vmeasure3: AVERAGEA() of rank3 = result3
    then
    (Calculated field, I think )Hmeasure4: AVERAGEA() of results
    results will be as one row (3 cells) so AVERAGEA() will calculate it. (can be simply AVERAGE() , AVERAGEA() in last step is not necessary)

    AVERAGEA of AVERAGEAs doesn't work in one "formula" and doesn't matter it will be DAX: AVERAGEA or AVERAGE

    *V-vertical, H-horizontal

    but I think it will be better: AVERAGEX()
    Last edited by sandy666; 04-19-2016 at 07:39 PM.

  8. #8
    Forum Contributor
    Join Date
    06-17-2014
    Location
    london
    MS-Off Ver
    365
    Posts
    398

    Re: Help to write a DAX measure to average three columns ignoring blanks

    I think I have manged to figure this out. thanks for all your help

  9. #9
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Help to write a DAX measure to average three columns ignoring blanks

    I wish you luck

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Rolling average with data in a row using only last 10 entries ignoring blanks
    By Lasers Reef in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-22-2013, 09:37 PM
  2. [SOLVED] Average last n numbers ignoring blanks
    By Cryptic in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 06-06-2013, 07:05 AM
  3. Find average of K nearest neighbours ignoring blanks
    By tucanj in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-17-2013, 10:01 PM
  4. Average tabs ignoring blanks
    By jbwizoz in forum Excel General
    Replies: 3
    Last Post: 11-16-2011, 05:00 PM
  5. Average ignoring Blanks cells
    By Justinmih in forum Excel General
    Replies: 10
    Last Post: 09-30-2011, 06:21 PM
  6. UDF to calculate average according to condition, ignoring blanks
    By dmitry in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 02-14-2011, 05:51 PM
  7. Replies: 1
    Last Post: 01-25-2011, 10:37 PM
  8. [SOLVED] Conditional Average Ignoring Blanks
    By Dirk Friedrichs via OfficeKB.com in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-06-2005, 11:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1