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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Bobbys
Helper III
Helper III

Average of averages

Hi everyone.

 

I'm struggling with making my Matrix visual show the average of the column. 

Bobbys_0-1664971819112.png

Note that the values for each row are averages as well. This is the DAX I've used: 

COGS endring1 = AVERAGEX(VALUES('calendar'[Time period sort]), [COGS previous period])
The total should be (0 + 0 + 0,39 + 0,17) / 4 = 0,14
Any help would be well appreciated

 

1 ACCEPTED SOLUTION

Hi @Bobbys ,

 

COGS_ending1 =
VAR _COGS_ending1 =
    AVERAGEX ( VALUES ( 'calendar'[Time period sort] ), [COGS previous period] )
VAR _SUMMAIRZE =
    SUMMARIZE (
        'Table',
        [Product],
        "COGSendring1", AVERAGEX ( VALUES ( 'calendar'[Time period sort] ), [COGS previous period] )
    )
RETURN
    IF (
        HASONEVALUE ( 'Table'[Product] ),
        _COGS_ending1,
        AVERAGEX ( _SUMMAIRZE, [COGSendring1] )
    )

In my sample, the [COGS previous period] part equal to average(table[]value]). Result is as below.

RicoZhou_0-1665475400787.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Bobbys
Helper III
Helper III

Anyone?

Hi @Bobbys ,

 

COGS_ending1 =
VAR _COGS_ending1 =
    AVERAGEX ( VALUES ( 'calendar'[Time period sort] ), [COGS previous period] )
VAR _SUMMAIRZE =
    SUMMARIZE (
        'Table',
        [Product],
        "COGSendring1", AVERAGEX ( VALUES ( 'calendar'[Time period sort] ), [COGS previous period] )
    )
RETURN
    IF (
        HASONEVALUE ( 'Table'[Product] ),
        _COGS_ending1,
        AVERAGEX ( _SUMMAIRZE, [COGSendring1] )
    )

In my sample, the [COGS previous period] part equal to average(table[]value]). Result is as below.

RicoZhou_0-1665475400787.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Bobbys
Helper III
Helper III

Thanks for the response @amitchandak
I've tried that already. The problem with that is that my totals dissapear when using Values(Table[Product]). 

Bobbys_0-1664995942913.png

 

No idea why... 

amitchandak
Super User
Super User

@Bobbys , if the product is above the time then it needs to like

 

COGS endring1 = AVERAGEX(VALUES('Product'[Product]), [COGS previous period])

 

till product level follow aggregation of measure - COGS previous period

post that avg of products

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.