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
pbeeyeqs
Helper I
Helper I

AVG of Calendar Years

Each month there is a value. Trying to show the CALENDAR YEARLY AVERAGE by calculating, for example:

2018 YEARLY AVG = (DEC 2018 VALUE - DEC 2017 VALUE) / DEC 2017 VALUE

Then, have a table showing the average for each year:

 

2018 = 1.910%

2017 = 2.109%
...
sample data

DATEVALUE
12/1/2018251.233
11/1/2018252.038
10/1/2018252.885
9/1/2018252.439
8/1/2018252.146
7/1/2018252.006
6/1/2018251.989
5/1/2018251.588
4/1/2018250.546
3/1/2018249.554
2/1/2018248.991
1/1/2018247.867
12/1/2017246.524
11/1/2017246.669
10/1/2017246.663
9/1/2017246.819
8/1/2017245.519
7/1/2017244.786
6/1/2017244.955
5/1/2017244.733
4/1/2017244.524
3/1/2017243.801
2/1/2017243.603
1/1/2017242.839
12/1/2016241.432
1 ACCEPTED SOLUTION
v-lid-msft
Community Support
Community Support

Hi @pbeeyeqs ,

 

We can create tables using following DAX to meet your requirement.

 

Table 2 =
VAR result =
    ADDCOLUMNS (
        SUMMARIZECOLUMNS ( 'Table'[DATE].[Year] ),
        "AVG", DIVIDE (
            LOOKUPVALUE ( 'Table'[VALUE], 'Table'[DATE], DATE ( [DATE].[Year], 12, 1 ) )
                - LOOKUPVALUE ( 'Table'[VALUE], 'Table'[DATE], DATE ( [DATE].[Year] - 1, 12, 1 ) ),
            LOOKUPVALUE ( 'Table'[VALUE], 'Table'[DATE], DATE ( [DATE].[Year] - 1, 12, 1 ) )
        )
    )
RETURN
    FILTER (
        result,
        [DATE].[Year] > MINX ( ALL ( 'Table' ), 'Table'[DATE].[Year] )
    )

 

AVG-of-Calendar-Years-1.png

 

BTW, pbix as attached.

 

Community Support Team _ DongLi
If this post helps, then please consider Accept it as the solution to help the other members find it more 

Community Support Team _ Dong Li
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

3 REPLIES 3
v-lid-msft
Community Support
Community Support

Hi @pbeeyeqs ,

 

We can create tables using following DAX to meet your requirement.

 

Table 2 =
VAR result =
    ADDCOLUMNS (
        SUMMARIZECOLUMNS ( 'Table'[DATE].[Year] ),
        "AVG", DIVIDE (
            LOOKUPVALUE ( 'Table'[VALUE], 'Table'[DATE], DATE ( [DATE].[Year], 12, 1 ) )
                - LOOKUPVALUE ( 'Table'[VALUE], 'Table'[DATE], DATE ( [DATE].[Year] - 1, 12, 1 ) ),
            LOOKUPVALUE ( 'Table'[VALUE], 'Table'[DATE], DATE ( [DATE].[Year] - 1, 12, 1 ) )
        )
    )
RETURN
    FILTER (
        result,
        [DATE].[Year] > MINX ( ALL ( 'Table' ), 'Table'[DATE].[Year] )
    )

 

AVG-of-Calendar-Years-1.png

 

BTW, pbix as attached.

 

Community Support Team _ DongLi
If this post helps, then please consider Accept it as the solution to help the other members find it more 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

One more question:


Because the current year is not completed, it gives -100%. How would you force it to give YTD for the current year?

Thanks

Hi @pbeeyeqs ,

 

you can change the date value in LookupValue, if you have any further question, fell free to create a new post and describe your promble rather than reply in a answered question.

 

Thank you for your support.

 

Community Support Team _ DongLi

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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