cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Esprami Frequent Visitor
Frequent Visitor

Average by category

Hi all!

 

I am trying to calculate an average of day-difference by specific categories. I created a custom table comprising the unique categories under a column called "WAC Item Category", then I created a new column called "Avrg Days" (where I want to calculate an average of day-difference) by using the following different syntaxes that always brought the same result:

 

  • Avrg Days = calculate(average('iic WAC Memo'[DayDiff]),'WAC Cat'[WAC Item Category])
  • Avrg Days = calculate(average('iic WAC Memo'[DayDiff]),all('WAC Cat'[WAC Item Category]))
  • Avrg Days = calculate(average('iic WAC Memo'[DayDiff]),ALLSELECTED('WAC Cat'[WAC Item Category]))
  • Avrg Days = IF (
        HASONEFILTER ( 'WAC Cat'[WAC Item Category] ),
        CALCULATE ( AVERAGE ( 'iic WAC Memo'[DayDiff] ), ALLEXCEPT ( 'WAC Cat', 'WAC Cat'[WAC Item Category] ) ),
        AVERAGEX (
                    VALUES ( 'WAC Cat'[WAC Item Category] ),
                    CALCULATE ( AVERAGE ( 'iic WAC Memo'[DayDiff] ), ALLEXCEPT ( 'WAC Cat', 'WAC Cat'[WAC Item Category] ) )
        )
    )

 

The result that I always get is this:

 

Power BI Average.JPG

 

I have consulted other posts discussing similar issues but solutions are not working in my case. I am definitely missing something here, any guess?

 

Thanks!