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

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
PowerRon
Post Patron
Post Patron

DAX : Only show average sale per year on year level

Hi

this is my matrix and I only want to to show Yearly Avg Per Day on the year level.
Knipsel.JPG

 

I created two measures (see below), but both don't give the desired result. What am I doing wrong

Yearly Avg Per Day 2 =
IF(
    --ISINSCOPE('Calendar'[Date].[Year]),
    ISFILTERED('Calendar'[Date].[Year]),
AVERAGEX(
    CALCULATETABLE(
        VALUES('Calendar'[Date]),
        ALL('Calendar'        ),
        'Calendar'[CalendarYear]=MAX('Calendar'[CalendarYear])
    ),
    [Total Sales]
),
BLANK()
)



Yearly Avg Per Day 3 =
VAR _average =
AVERAGEX(
    CALCULATETABLE(
        VALUES('Calendar'[Date]),
        ALL('Calendar'        ),
        'Calendar'[CalendarYear]=MAX('Calendar'[CalendarYear])
    ),
    [Total Sales]
)
RETURN
SWITCH(TRUE(),
ISINSCOPE('Calendar'[Date].[Year]),_average,
BLANK()
)
 
Regards

@v-yueyunzh-msft  , do you have any idea?
1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

I tried to create a sample pbix file like below.

 

Jihwan_Kim_0-1676798605120.png

 

Jihwan_Kim_1-1676798617513.png

 

Sales avg per year: =
VAR _currentyear =
    MAX ( 'Calendar'[Year] )
RETURN
    SWITCH (
        TRUE (),
        ISINSCOPE ( 'Calendar'[Month] ), BLANK (),
        ISINSCOPE ( 'Calendar'[Qtr] ), BLANK (),
        ISINSCOPE ( 'Calendar'[Year] ),
            AVERAGEX (
                ADDCOLUMNS (
                    FILTER ( ALL ( 'Calendar' ), 'Calendar'[Year] = _currentyear ),
                    "@sales", CALCULATE ( SUM ( Data[Sales] ) )
                ),
                [@sales]
            )
    )

 

 


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.


Click here to visit my LinkedIn page

View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

I tried to create a sample pbix file like below.

 

Jihwan_Kim_0-1676798605120.png

 

Jihwan_Kim_1-1676798617513.png

 

Sales avg per year: =
VAR _currentyear =
    MAX ( 'Calendar'[Year] )
RETURN
    SWITCH (
        TRUE (),
        ISINSCOPE ( 'Calendar'[Month] ), BLANK (),
        ISINSCOPE ( 'Calendar'[Qtr] ), BLANK (),
        ISINSCOPE ( 'Calendar'[Year] ),
            AVERAGEX (
                ADDCOLUMNS (
                    FILTER ( ALL ( 'Calendar' ), 'Calendar'[Year] = _currentyear ),
                    "@sales", CALCULATE ( SUM ( Data[Sales] ) )
                ),
                [@sales]
            )
    )

 

 


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.


Click here to visit my LinkedIn page

This works @Jihwan_Kim 

Thank you very much.

Regards
Ron

Helpful resources

Announcements
Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.